On 9/9/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
> On 9/9/07, Joseph Kocherhans <[EMAIL PROTECTED]> wrote:
> >
> > I'd like to change the 'fields' attribute on ModelAdmin to
> > 'fieldsets', and use 'fields' for a tuple of field names rather than a
> > list of (fieldset_name, options) tuples. Only one of those two options
> ...
> > Any serious opposition?
>
> Sounds ok to me - with the need for one clarification. What happens if
> I specify both a fields and a fieldsets argument? Is fields ignored?
> Is it merged into the 'none' fieldset? Used as the none fieldset as
> long as one isn't specified?
I think django.core.management.validation should verify that only one
of the two is defined and issue an error if they both are.
> I also have one slightly larger suggestion in this area: that we
> extract fieldsets out of contrib.admin and put them in
> newforms-proper, and expose a fieldsets argument into the
> form_for_model/instance functions. For my money, the options for
> ModelAdmin should be a match for what forms_for_model/instance can do
> (although obviously the admin options will be augmented somewhat to
> expose nifty widgets, behavior etc.). If we need a feature for admin,
> chances are an end users will need it for their forms.
I'd really hate to see any more display logic go into BaseForm. The
Admin wrapper classes work quite well, and will be even better once I
clean them up a bit. I'd rather see their more generic parts extracted
out into django.newforms.display or possibly a new contrib package.
Maybe something like this:
form = form_for_model(MyModel)
fieldsets = [
('my fieldset', {'fields': ['one', 'two', 'three'],
'description': 'blah'})
html_form = HTMLForm(form, fieldsets)
HTMLForm's __iter__ would iterate over Fieldset objects, etc. Pretty
much exactly like the admin wrapper classes do now. It isn't quite as
convenient as directly passing fieldsets into form_for_model, but it
would allow people the flexibility that they're going to scream for
once they think they can define all their display stuff in python
rather than writing html.
Joseph
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---