Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#11140 closed (invalid)

modelForm fields Meta, if only one specified results empty form

Reported by: davidarakelian Owned by: nobody
Component: Forms Version: dev
Severity: Keywords: forms, modelForm, fields, meta, empty form
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have the following Modelform.

class EditPicture(forms.ModelForm):
    class Meta:
        model = Photo
        fields = ('title','description')

If I change fields to ('title')

class EditPicture(forms.ModelForm):
    class Meta:
        model = Photo
        fields = ('title')

This produces an empty form. Whenever I try to built a form(from a model) with only 1 field it shows up an empty form.

Change History (2)

comment:1 by Alex Gaynor, 15 years ago

Resolution: invalid
Status: newclosed

That's because you specified a string, not an iterable (such as a tuple) for fields. Please don't use trac to ask support questions.

comment:2 by davidarakelian, 15 years ago

oh sorry,

so I am forced to use a

fields = ('title',)
instead of
fields = ('title')

If I want to have only one field based form... argh

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