diff options
| author | Tom Christie | 2013-10-21 17:19:28 +0100 |
|---|---|---|
| committer | Tom Christie | 2013-10-21 17:19:28 +0100 |
| commit | 216ac8a5c1ba39bf24e4e91b6fac7e0ac1dee7e4 (patch) | |
| tree | e01935f5cbdb3a229726111700ebb4e5edcfe06f /rest_framework | |
| parent | 76672787cdba6a4ab8173b51fa099c910556889b (diff) | |
| download | django-rest-framework-216ac8a5c1ba39bf24e4e91b6fac7e0ac1dee7e4.tar.bz2 | |
Use lookup_url_kwarg in presave if required
Diffstat (limited to 'rest_framework')
| -rw-r--r-- | rest_framework/mixins.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/rest_framework/mixins.py b/rest_framework/mixins.py index 426865ff..4606c78b 100644 --- a/rest_framework/mixins.py +++ b/rest_framework/mixins.py @@ -158,7 +158,8 @@ class UpdateModelMixin(object): Set any attributes on the object that are implicit in the request. """ # pk and/or slug attributes are implicit in the URL. - lookup = self.kwargs.get(self.lookup_field, None) + lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field + lookup = self.kwargs.get(lookup_url_kwarg, None) pk = self.kwargs.get(self.pk_url_kwarg, None) slug = self.kwargs.get(self.slug_url_kwarg, None) slug_field = slug and self.slug_field or None |
