Opened 18 years ago

Closed 18 years ago

#1674 closed defect (fixed)

[patch] generic update_object does not handle model with pk named other than "id"

Reported by: pmd@… Owned by: Jacob
Component: Generic views Version: magic-removal
Severity: major Keywords: primary_key
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If a model uses its own primary key rather than default "id" the update_object method throws an exception:

Traceback (most recent call last):
File "/data/home/pmd/django/magic-removal/django/core/handlers/base.py" in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File "/data/home/pmd/django/magic-removal/django/views/generic/create_update.py" in update_object
  104. manipulator = model.ChangeManipulator(object.id, follow=follow)

  AttributeError at /leo/npc/materials/16GALNS4PC1/edit/
  'Material' object has no attribute 'id'

Attachments (1)

pkgenviewupd.diff (544 bytes ) - added by pmd@… 18 years ago.

Download all attachments as: .zip

Change History (3)

by pmd@…, 18 years ago

Attachment: pkgenviewupd.diff added

comment:1 by pmd@…, 18 years ago

Summary: generic update_object does not handle model with pk named other than "id"[patch] generic update_object does not handle model with pk named other than "id"

This is also probably related to #1115

comment:2 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [2728]) magic-removal: Fixed #1674 -- Generic update_object() view now handles PKs named something other than 'id'

Note: See TracTickets for help on using tickets.
Back to Top