Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2579 closed defect (fixed)

[patch] raw_id_admin with ManyToMany does not properly handle 'empty' raw_id_admin fields

Reported by: brendan.mcadams@… Owned by: Adrian Holovaty
Component: Core (Other) Version: 0.95
Severity: normal Keywords: raw_id_admin many_to_many
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Despite a definition of blank=True, null=True, I've observed fields in 0.95 with raw_id_admin which do not allow said field to be 'empty'.

The issue appears to be related to the fact that the empty is translated in code to ; when the Relation manager attempts to search for these ids, it throws an exception.

The solution to this problem is to detect if it's raw_id_admin, and defined 'empty', and skip the 'add relations' call.

I have attached a patch which solves this problem.

Attachments (3)

fix_raw_id_admin_m2m.patch (754 bytes ) - added by brendan.mcadams@… 18 years ago.
Fix to skip 'empty' defined raw_id_admin fields and prevent errors
fix_raw_id_admin_m2m.2.patch (1.2 KB ) - added by brendan.mcadams@… 18 years ago.
[Version 2: Fixed a bug with original] Updated patch to correct ticket item. Allows for creating initially empty fields, and clearing fields.
fix_raw_id_admin_m2m.zj.patch (420 bytes ) - added by zakj@… 18 years ago.
I prefer this patch, which fixes the html2python method of RawIdAdmin.

Download all attachments as: .zip

Change History (7)

by brendan.mcadams@…, 18 years ago

Attachment: fix_raw_id_admin_m2m.patch added

Fix to skip 'empty' defined raw_id_admin fields and prevent errors

comment:1 by brendan.mcadams@…, 18 years ago

[patch]

comment:2 by brendan.mcadams@…, 18 years ago

There's a bug in this patch with repeat edits; I'm looking into it.

comment:3 by brendan.mcadams@…, 18 years ago

Summary: raw_id_admin with ManyToMany does not properly handle 'empty' raw_id_admin fields[patch] raw_id_admin with ManyToMany does not properly handle 'empty' raw_id_admin fields

Nevermind; PEBKAC. This patch does correct the stated problem.

by brendan.mcadams@…, 18 years ago

[Version 2: Fixed a bug with original] Updated patch to correct ticket item. Allows for creating initially empty fields, and clearing fields.

by zakj@…, 18 years ago

I prefer this patch, which fixes the html2python method of RawIdAdmin.

comment:4 by Malcolm Tredinnick, 18 years ago

Resolution: fixed
Status: newclosed

(In [3803]) Fixed #2579 -- Fixed a problem with empty raw_id_admin form fields. Thanks to
Brendan McAdams and zakj@… for some good diagnostic work on this one.

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