Django

Code

Ticket #1674 (closed: fixed)

Opened 3 years ago

Last modified 3 years ago

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

Reported by: pmd@hardlimit.co.uk Assigned to: jacob
Milestone: Component: Generic views
Version: magic-removal Keywords: primary_key
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

pkgenviewupd.diff (0.5 kB) - added by pmd@hardlimit.co.uk on 04/23/06 04:53:49.

Change History

04/23/06 04:53:49 changed by pmd@hardlimit.co.uk

  • attachment pkgenviewupd.diff added.

04/23/06 04:58:08 changed by pmd@hardlimit.co.uk

  • 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

04/23/06 16:21:52 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #1674 ([patch] generic update_object does not handle model with pk named other than "id")




Change Properties
Action