I\'ve got a bit of Django form code that looks like this:
class GalleryAdminForm(forms.ModelForm):
auto_id=False
order = forms.CharField(widget=forms
The following removes the ':' from all your form fields. I've only tried it with the forms.Form
class, but I believe it should work for forms.ModelForm
too.
In Django forms, the ':' after the labels is the label_suffix
. You can change or remove the label_suffix
by creating a subclass of ModelForm
, here called UnstyledForm
, and redefining the initialization function with label_suffix
set to an empty string. Then use your new UnstyledForm
class.
class UnstyledForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
kwargs.setdefault('label_suffix', '')
super(UnstyledForm, self).__init__(*args, **kwargs)
class GalleryAdminForm(UnstyledForm):
auto_id=False
order = forms.CharField(widget=forms.HiddenInput())
I hope that helps!