Code

Opened 7 years ago

Closed 7 years ago

#5174 closed (duplicate)

Formsets - is_valid() crashes unbound forms

Reported by: Simon Litchfield <simon@…> Owned by: adrian
Component: Forms Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Calling is_valid() on a formset that has no data (unbound) crashes with an attribute error

Attachments (1)

formsets-is_valid-5897.diff (1.4 KB) - added by Simon Litchfield <simon@…> 7 years ago.
Fixes unbound formsets is_valid() to behave like standard forms - NOTE this patch also includes a patch from ticket 5173

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by Simon Litchfield <simon@…>

Fixes unbound formsets is_valid() to behave like standard forms - NOTE this patch also includes a patch from ticket 5173

comment:1 Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Why on earth is_valid() should work for unbound forms? It's meaningless to do that, and that exception was made for purpose.

comment:2 Changed 7 years ago by korpios

  • Resolution invalid deleted
  • Status changed from closed to reopened

Anonymous users shouldn't be closing tickets.

comment:3 Changed 7 years ago by jkocherhans

  • Resolution set to duplicate
  • Status changed from reopened to closed

Duplicate of #4867. It may seem meaningless to call is_valid on an unbound form, but that's how Form behaves. Consistency wins here. If anyone wants to argue that both situations should raise something like an UnboundError, please bring it up on django-dev.

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.