Code

Opened 7 years ago

Closed 5 years ago

#6033 closed (fixed)

validation shouldn't take place when deleting inline objects

Reported by: akaihola Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: nfa-someday inline delete validation newforms
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

As noted originally in a comment to #5828, I noticed a slight usability problem with inline editing. I have a related model which only has a foreign key to the parent model and an e-mail field. So in the inline view I see the e-mail field and the delete checkbox. If I both clear the e-mail field and check the delete checkbox, I get a validation error for the blank e-mail address, which doesn't make sense since I'm removing it anyway.

Brosner commented: "Interesting point. Sounds like the deletion needs to happen before any validation. akaihola, could you open a new ticket about that. That is unrelated to this ticket, but is a good point. I'd hate for this ticket to be fixed and your issue doesn't get fixed as it should."

Attachments (5)

is_empty_clean_field.diff (4.8 KB) - added by Øyvind Saltvik <oyvind@…> 7 years ago.
Attempt at fixing this issue
is_empty_clean_field.2.diff (6.3 KB) - added by Øyvind Saltvik <oyvind@…> 7 years ago.
Closer, still some problems with form for queryset/BaseModelFormSet
is_empty_clean_field.3.diff (7.9 KB) - added by Øyvind Saltvik <oyvind@…> 7 years ago.
Patched against the correct path/ includes patch from #5828
is_empty_clean_field.4.diff (5.7 KB) - added by Øyvind Saltvik <oyvind@…> 7 years ago.
This one actually works
is_empty_clean_field.5.diff (4.8 KB) - added by Øyvind Saltvik <oyvind@…> 7 years ago.
Got to remember to look at my patches before posting them

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by Øyvind Saltvik <oyvind@…>

Attempt at fixing this issue

comment:1 Changed 7 years ago by Øyvind Saltvik <oyvind@…>

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

The problem here is that cleaned_data does not exist on the form if full clean does not validate.

Tried solving it by adding a clean_field method to the formset to clean only specific fields on the form.

Comments appreciated.

Changed 7 years ago by Øyvind Saltvik <oyvind@…>

Closer, still some problems with form for queryset/BaseModelFormSet

comment:2 Changed 7 years ago by Øyvind Saltvik <oyvind@…>

Latest patch seems to work.

Changed 7 years ago by Øyvind Saltvik <oyvind@…>

Patched against the correct path/ includes patch from #5828

comment:3 Changed 7 years ago by Øyvind Saltvik <oyvind@…>

Just noticed this patch only deletes if all rows are checked.

Changed 7 years ago by Øyvind Saltvik <oyvind@…>

This one actually works

Changed 7 years ago by Øyvind Saltvik <oyvind@…>

Got to remember to look at my patches before posting them

comment:4 Changed 7 years ago by Øyvind Saltvik <oyvind@…>

  • Has patch set
  • Keywords validation newforms added

comment:5 Changed 7 years ago by brosner

  • Keywords nfa-someday added
  • Triage Stage changed from Unreviewed to Design decision needed

I am really on the fence with this idea now. The end-user may argue otherwise with a valid argument. The changes stem out of newforms-admin to be accomplished. However, the bottom line is that this is not critical before merging so I am tagging with nfa-someday.

comment:6 Changed 5 years ago by MarisN

As my users hit this issue time to time and also NFA can be considered stable, would it be possible to fix this issue? As my python sk33lz are poor, no comments about patches.

comment:7 Changed 5 years ago by jkocherhans

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

This was fixed in [10283].

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.