Get created_by and modified_by updating automatically.

This commit is contained in:
Chris Church
2014-04-01 21:27:32 -04:00
parent d632aa0af9
commit 118ddf97f6
12 changed files with 172 additions and 6 deletions

View File

@@ -253,11 +253,7 @@ class ListAPIView(generics.ListAPIView, GenericAPIView):
class ListCreateAPIView(ListAPIView, generics.ListCreateAPIView):
# Base class for a list view that allows creating new objects.
def pre_save(self, obj):
super(ListCreateAPIView, self).pre_save(obj)
if isinstance(obj, PrimordialModel):
obj.created_by = self.request.user
pass
class SubListAPIView(ListAPIView):
# Base class for a read-only sublist view.