Code

Opened 5 years ago

Closed 4 years ago

#11192 closed (fixed)

ModelForms development error messages

Reported by: TonyK Owned by: TonyK
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

from django.forms import ModelForm

class TrustForm(ModelForm):

    class Meta:
        pass # forgotten model attribute here

If Meta in formclass has no model attribute it raises exception like this:

TypeError at /exampleurl/ 'NoneType' object is not callable.

I guess my patch makes more informative exception messages. ValueError and TypeError may be wrong here, may be use AssertError instead, don't know.

Attachments (1)

ModelForms_checks.patch (785 bytes) - added by TonyK 5 years ago.

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by TonyK

comment:1 Changed 5 years ago by TonyK

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

There is patch for form/models.py

comment:2 Changed 5 years ago by kmtracey

  • milestone 1.1 deleted

Please don't put things in the 1.1 milestone unless they are critical bugs. A perhaps non-ideal error message does not fit into that category.

comment:3 Changed 5 years ago by TonyK

  • Has patch set

Sorry, didn't known milestone stuff. (it is my first ticket and patch)

comment:4 Changed 5 years ago by Alex

  • Triage Stage changed from Unreviewed to Design decision needed

comment:5 Changed 4 years ago by anonymous

The problem has been fixed in 1.2 release. Thanks.

comment:6 Changed 4 years ago by russellm

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

I can't reproduce this with 1.1 or 1.2.

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.