Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 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
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: UI/UX:

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@… 8 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@… 8 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@… 8 years ago.
I prefer this patch, which fixes the html2python method of RawIdAdmin.

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by brendan.mcadams@…

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

comment:1 Changed 8 years ago by brendan.mcadams@…

[patch]

comment:2 Changed 8 years ago by brendan.mcadams@…

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

comment:3 Changed 8 years ago by brendan.mcadams@…

  • Summary changed from raw_id_admin with ManyToMany does not properly handle 'empty' raw_id_admin fields to [patch] raw_id_admin with ManyToMany does not properly handle 'empty' raw_id_admin fields

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

Changed 8 years ago by brendan.mcadams@…

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

Changed 8 years ago by zakj@…

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

comment:4 Changed 8 years ago by mtredinnick

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

(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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.