Invoke super from UpdateModelMixin.pre_save

Allows a subclass of GenericAPIView to add its own pre_save logic which will affect CreateMixin, but once UpdateMixin is added it isn't called.

Since GenericAPIView has an empty implementation of pre_save, calling it on super should be safe.
This commit is contained in:
Paul Melnikow 2014-01-02 16:50:00 -05:00
parent 2921455ea7
commit 002e672952

View File

@ -163,6 +163,7 @@ class UpdateModelMixin(object):
""" """
Set any attributes on the object that are implicit in the request. Set any attributes on the object that are implicit in the request.
""" """
super(UpdateModelMixin, self).pre_save(obj)
# pk and/or slug attributes are implicit in the URL. # pk and/or slug attributes are implicit in the URL.
lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
lookup = self.kwargs.get(lookup_url_kwarg, None) lookup = self.kwargs.get(lookup_url_kwarg, None)