ModelFormOptions not automatically populated

Issue #4 resolved
Anonymous created an issue

It would be nice if the ModelFormMetaclass's ModelFormOptions object was populated with the 'fields' key in BetterModelForm.fieldsets.

Here's a copy of that class:



class ModelFormOptions(object): def init(self, options=None): self.model = getattr(options, 'model', None) self.fields = getattr(options, 'fields', None) self.exclude = getattr(options, 'exclude', None) }}}

Currently the fields attribute does not receive a copy of the fields used in BetterModelForm.fieldsets.

If the BetterModelForm doesn't contain //all// the required fields, the form will not validate correctly.

The current work-around is to include all the fields in the fieldsets attribute in the fields attribute:



class SampleForm(BetterModelForm): fieldsets = ( ('main', { 'fields: ('field_a', 'field_b'), }) ) fields = ('field_a', 'field_b') }}}

This isn't a big deal, but it would be nice if this was documented. Or, even better yet, if the fieldset fields would be copied into SampleForm.fields automatically.

Comments (2)

  1. Log in to comment