Code

Opened 6 years ago

Closed 6 years ago

#7182 closed (invalid)

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

Reported by: mwdiers <martin@…> Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 (0)

Change History (6)

comment:1 Changed 6 years ago by brosner

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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?

comment:2 Changed 6 years ago by mwdiers <martin@…>

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

comment:3 Changed 6 years ago 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. ;)

comment:4 Changed 6 years ago by mwdiers <martin@…>

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.

comment:5 Changed 6 years ago by mwdiers <martin@…>

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

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

comment:6 Changed 6 years ago by mwdiers <martin@…>

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

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.