mirror of https://github.com/django/django.git
Fixed #2362 -- Corrected the way we retrieve an object so that it works for
one-to-one fields. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3849 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
789f30258a
commit
11416e4a54
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue