Well so far the only "not so ugly way" (in the sense that it is only
one line of code) I have found to do this is to change the css
directly (in my case admin.css):
/* Hacky way to remove hidden field lavel in the Admin console */
div.form-row.last_modified { display: none;}

On 7 mai, 09:23, PierreR <[email protected]> wrote:
> That is what I do !
> (another way is to define a custom model field and override the
> "formfield" method).
>
> But ... I cannot get rid off the label in the admin console. That is
> my problem.
>
> Any easy way to remove the label of an hidden field in the admin
> console ?
>
> Thanks.
>
> On 6 mai, 17:24, Daniel Roseman <[email protected]> wrote:
>
> > On May 6, 4:48 pm, PierreR <[email protected]> wrote:
>
> > > I don't seem to find a good way to have a hidden field in the admin
> > > console. I can of course get the hidden field easily but the label is
> > > still showing up. This problem is really related to the Admin app.
>
> > > I have been trying to "hack" the "fieldset.html" but it is not that
> > > easy. "is_hidden" is only available on field.field ...
>
> > > The best solution is probably to get the hidden fields to go in a
> > > different fieldset (admin wise) so I can apply a style on the fieldset
> > > level, not on the fieldlevel.
>
> > > The following solution will not work if I need to mark as hidden a
> > > field of a base class:
>
> > >http://groups.google.com/group/django-users/browse_thread/thread/10fd...
>
> > > Any idea ? Thanks very much.
>
> > The best way to do this is to define a custom modelform for your admin
> > class, and override the definition of your field there to make it use
> > a  HiddenInput widget.
>
> > class MyForm(forms.ModelForm):
> >     myfield = forms.CharField(widget=forms.HiddenInput)
> >     class Meta:
> >         model = MyModel
>
> > class MyAdmin(admin.ModelAdmin):
> >     form = MyForm
>
> > admin.site.register(MyModel, MyAdmin)
> > --
> > 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