I'd like to eliminate the colon (:) that is automatically added to form labels across my entire Django project. I'd like to avoid adding label_suffix=''
to every form in the project.
Is there a simple way to override it everywhere?
It would probably be best to extend Django's Form
class, override the default, and extend all of your forms from it, like so:
from django import forms
class MySiteForm(forms.Form):
def __init__(self, *args, **kwargs):
kwargs.setdefault('label_suffix', '')
super(MySiteForm, self).__init__(*args, **kwargs)
...
class RegistrationForm(MySiteForm):
username = forms.CharField(max_length=255)
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With