Opened 9 years ago

Closed 9 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: UI/UX:

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@… 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by pmd@…

comment:1 Changed 9 years ago by pmd@…

  • Summary changed from generic update_object does not handle model with pk named other than "id" to [patch] generic update_object does not handle model with pk named other than "id"

This is also probably related to #1115

comment:2 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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