Thanks Andy,

I don't know if there is a good way to do this without hacking the
admin too much. I have been trying to get all hidden fields in a
separate fieldset which seem more in line with the "fieldset"
philosophy. I have created an  __init__ method in my custom admin
class (the one that extends ModelAdmin). At the end, it was not so
easy to get a right filter while processing "model._meta.fields" in
order to dynamically create the fieldset. I have given up considering
that the css hack was good enough.

I am a bit puzzled by the fact that the admin app does not seem to
respect or use the generic django form method (as_table, ...) to
display labels and fields. All the fieldset mechanism is specific to
the admin app and looks kind of awkward to me (it does not support
inheritance). Maybe some historic reasons ?

On 7 mai, 12:53, Andy <[email protected]> wrote:
> Hello Pierre.
>
> I recently came across the exact same problem (and for the exact same
> reason)
>
> I don't think my solution was any less ugly that yours. I modified
> fieldset.html to look for a specific fieldset name. Anything in that
> fieldset is displayed in a manner which honors the hidden field
> property.
>
> (so still a hack!)
>
> Andy
>
> On May 7, 10:01 am, PierreR <[email protected]> wrote:
>
> > Thanks for your reply.
>
> > My intention is to use this field as a version/timestamp to implement
> > a form of optimistic locking. I need to receive it back from the user
> > through a form and check it against the current version/timestamp of
> > the updated record.
>
> > I don't think "exclude" will work for me.
>
> > > Hmm. Does the field need to be in the form at all? You could just add
> > > it to the 'exclude' tuple in the ModelAdmin declaration, then it won't
> > > show up.
> > > --
> > > DR.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to