From 5a2b52c9e8007edc483a4e94988c58106a6d2b4b Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sun, 23 Apr 2006 21:21:51 +0000 Subject: [PATCH] magic-removal: Fixed #1674 -- Generic update_object() view now handles PKs named something other than 'id' git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2728 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/views/generic/create_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py index 9f0f7a416d..b95eb5a7e8 100644 --- a/django/views/generic/create_update.py +++ b/django/views/generic/create_update.py @@ -101,7 +101,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(object.id, follow=follow) + manipulator = model.ChangeManipulator(getattr(object, object._meta.pk.name), follow=follow) if request.POST: new_data = request.POST.copy()