Django

Code

Ticket #7182 (closed: invalid)

Opened 2 weeks ago

Last modified 2 weeks ago

Extra MultiWidget fields in Inline in Admin are validating when left blank

Reported by: mwdiers <martin@diers.us> Assigned to: nobody
Component: Admin interface Version: newforms-admin
Keywords: Cc:
Triage Stage: Unreviewed Has patch: 0
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description

The fix to bug 7160 caused a regression. Now when saving a record with an Inline, any "extra" fields in the inline are being validated, even when left empty, and thus are throwing "This Field is Required" errors.

Attachments

Change History

05/06/08 16:46:00 changed by brosner

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

Can you please provide more specific details? The only change made in [7517] was to the MultiWidget? which would indicate the problem still exists with it. You say "extra fields" and I am not sure what exactly you mean?

05/06/08 17:21:23 changed by mwdiers <martin@diers.us>

  • summary changed from Extra fields in Inline in Admin are validating when left blank to Extra MultiWidget fields in Inline in Admin are validating when left blank.

Extra fields as in the extra blank records which are displayed for TabularInline? or StackedInline? editing:

class TextRangeInline(admin.StackedInline):
	model = TextRange
	extra = 3
	listdisplay = ('start', 'end',)

Start and End are MultiValueFields? stored as Integers, and edited through a MultiWidget?.

So I would imagine that the problem would net occur when the Inline contains no MultiWidget? fields.

05/06/08 18:39:41 changed by brosner

I can't reproduce the problem. Are start and end required fields? If not then make sure you have have marked them as not being required. I am beginning to wonder if the bug fix has uncovered a problem in your code. If you can post some more specific details that would be nice otherwise I will close this ticket. For the record listdisplay isn't even a valid option. Neither does list_display even mean anything for an inline. ;)

05/06/08 21:26:43 changed by mwdiers <martin@diers.us>

You are correct. Sorry for the false alarm.

My MultiWidget? had a Select Widget, and the first line of my choices was (None, '------------'). This worked before. None was being recognized as no selection. Now, after the MultiWidget? fix, None was being recognized as a selection. I changed the first line of choices to (, '------------'), which corrected the problem.

Not sure how listdisplay got in there originally.

05/06/08 21:28:33 changed by mwdiers <martin@diers.us>

WikiFormatting screwed that up. Rather, first choice was changed to:

('', '------------')

05/06/08 21:30:23 changed by mwdiers <martin@diers.us>

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

Add/Change #7182 (Extra MultiWidget fields in Inline in Admin are validating when left blank)




Change Properties
Action