Opened 13 years ago

Closed 12 years ago

#18391 closed Bug (needsinfo)

Inline forms fail to delete objects when PK is a custom field

Reported by: max@… Owned by: nobody
Component: contrib.admin Version: dev
Severity: Normal Keywords: inline form custom field
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have custom field type. It's a uuid. If I make an inline form in admin interface with a model that has this custom field as a primary key I can't delete it from the admin interface. I get an error that a NoneType doesn't have some attributes.

The problem is that in _construct_form the primary key is got via get_db_prep_lookup which will always return a string. But in _existing_object when it initializes self._object_dict is just takes an object. Which must not be of a string type.

Patch to eliminate it is attached.

Attachments (1)

inline_form_custom_field.patch (867 bytes ) - added by max@… 13 years ago.
patch to fix inline forms and custom field types

Download all attachments as: .zip

Change History (4)

by max@…, 13 years ago

patch to fix inline forms and custom field types

comment:1 by Aymeric Augustin, 13 years ago

Easy pickings: unset
Needs tests: set

comment:2 by Aymeric Augustin, 12 years ago

The patch doesn't contain a test case. Could you provide a minimal example that triggers the bug (custom field, model and admin definitions)? Or at least the full traceback? That would save us some guesswork! :)

comment:3 by Aymeric Augustin, 12 years ago

Component: Formscontrib.admin
Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top