Opened 9 years ago

Closed 9 years ago

#3681 closed (wontfix)

Placing newforms in model breaks syncdb

Reported by: mrstone@… Owned by: adrian
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by mtredinnick)


I placed a newform calss "inline" in a model. It works fine but breaks syncdb

class MyModel(models.Model): 
    name = models.CharField(maxlength=200)   
    descr = models.CharField(maxlength=300) 

    class EditForm(forms.Form):
        name = forms.CharField(label="Name", max_length=200)
        descr = forms.CharField(label="Description", max_length=200)

Change History (4)

comment:1 Changed 9 years ago by ubernostrum

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

What error do you see when trying to run syncdb with this model?

comment:2 Changed 9 years ago by mrstone@…

Error: Couldn't install apps, because there were errors in one or more models: init() got an unexpected keyword argument 'label'

comment:3 Changed 9 years ago by mtredinnick

  • Description modified (diff)

comment:4 Changed 9 years ago by adrian

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

The solution to this problem is, "Don't do that." I see no reason why we should support forms in models, given that models are "magic" objects whose attributes and inner classes do special things.

Note: See TracTickets for help on using tickets.
Back to Top