#23921: Can't hide a hidden field in the django admin
-------------------------------+--------------------
Reporter: DoctorMalboro | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I have a form in django 1.6.5 like this:
{{{
#!python
class ExampleForm(forms.ModelForm):
id_image = forms.CharField(widget=forms.HiddenInput())
image = forms.ImageField(widget=CustomImageUploader())
# Tried this
def __init__(self, *args, **kwargs):
super(ExampleForm, self).__init__(*args, **kwargs)
if self.instance and self.instance.pk:
self.fields['id_image'].widget = forms.HiddenInput()
class Meta:
fields = ('id_image', 'image',)
}}}
And I couldn't find a way to hide the form in the django's admin. I can't
exclude it because I have a custom form with a javascript function that
fills the id_image field, so the only way I have to do this is by hiding
the value, because it doesn't look nice for the end user.
--
Ticket URL: <https://code.djangoproject.com/ticket/23921>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.1c545a82facbeed9ec71ae4f1dff7327%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.