Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #2362 -- Corrected the way we retrieve an object so that it wor…

…ks for

one-to-one fields.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3849 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 11416e4a54425e4ea91a509fe25d94afb27a1e83 1 parent 789f302
@malcolmt malcolmt authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 django/views/generic/create_update.py
View
6 django/views/generic/create_update.py
@@ -102,7 +102,7 @@ def update_object(request, model, object_id=None, slug=None,
except ObjectDoesNotExist:
raise Http404, "No %s found for %s" % (model._meta.verbose_name, lookup_kwargs)
- manipulator = model.ChangeManipulator(getattr(object, object._meta.pk.name), follow=follow)
+ manipulator = model.ChangeManipulator(getattr(object, object._meta.pk.attname), follow=follow)
if request.POST:
new_data = request.POST.copy()
@@ -142,7 +142,7 @@ def update_object(request, model, object_id=None, slug=None,
else:
c[key] = value
response = HttpResponse(t.render(c))
- populate_xheaders(request, response, model, getattr(object, object._meta.pk.name))
+ populate_xheaders(request, response, model, getattr(object, object._meta.pk.attname))
return response
def delete_object(request, model, post_delete_redirect,
@@ -196,5 +196,5 @@ def delete_object(request, model, post_delete_redirect,
else:
c[key] = value
response = HttpResponse(t.render(c))
- populate_xheaders(request, response, model, getattr(object, object._meta.pk.name))
+ populate_xheaders(request, response, model, getattr(object, object._meta.pk.attname))
return response

0 comments on commit 11416e4

Please sign in to comment.
Something went wrong with that request. Please try again.