Test that you can't post to an audit trail collection (ever), and a switch to control postability to sub lists.

This commit is contained in:
Michael DeHaan
2013-03-23 16:50:25 -04:00
parent cd214bc95d
commit 1213f2a981
3 changed files with 26 additions and 7 deletions

View File

@@ -51,6 +51,10 @@ class BaseSubList(BaseList):
def post(self, request, *args, **kwargs):
postable = getattr(self.__class__, 'postable', False)
if not postable:
return Response(status=status.HTTP_405_METHOD_NOT_ALLOWED)
parent_id = kwargs['pk']
sub_id = request.DATA.get('id')
main = self.__class__.parent_model.objects.get(pk=parent_id)