On May 6, 4:48 pm, PierreR <p.radermec...@gmail.com> 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 django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to