The (admin.ModelAdmin) "fieldsets" already does this in the admin site. Is
there a way of implementing this in these views?
Some options to consider: (ModelForm example)
{{{
class CustomerForm(ModelForm):
class Meta:
model = Customer
fieldsets = [
('Name and Address', {'fields' : [ ('first_name', 'last_name',
'mi'),
'address_1',
'address_2',
('city', 'state', 'zip_code')
]
}
)
('Phone and Email', {'fields' : [ #(etc...)
}}}
And be able to customize:
" 'classes' : " or you could give it a css or javascript class and put
it in your static file:
{{{
('Name and Address', {'fields' ('class' : ['name_field'], 'classes' :
['collapse'] ): [ ('first_name', (etc...)
}}}
And finally, make text input boxes the same "size" as the "max_length="
setting for the form or model.
Maybe there is an easy way to do all of this and I just couldn't find it
in the documentation. If so, please let me know, and sorry.
--
Ticket URL: <https://code.djangoproject.com/ticket/29137>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
Comment:
The ability to define fieldsets on forms is a duplicate of #6630 (closed
as wontfix).
Regarding automatically changing input boxes size based on `max_length` --
that would be a rather disruptive change and not something that everyone
would want. You could write a mixin for your forms to accomplish that.
--
Ticket URL: <https://code.djangoproject.com/ticket/29137#comment:1>