Is there any clever way to make django forms render field with asterisks after fields that are required? Or to provide some other clever for to mark required fields? I would
Personny I tried something like this, i.e. overriding the default template tag (this adds a red asterisk in all the admin interface for required not-readonly fields. Then i also defined a 2nd tag for my views that mix inline and block labels. See the code below (copy/paste of Django source code with some modifications):
In settings.py :
from django.forms.util import flatatt
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
import django.forms.forms as django_forms
def custom_label_tag(self, contents=None, attrs=None):
"""
Wraps the given contents in a
In my templates
{{ form.fieldname.errors}}{{ form.fieldname.inline_label_tag }}{{form.fieldname}}
OR
{{ form.fieldname.errors}}{{ form.fieldname.label_tag }}{{form.fieldname}}