2👍
✅
Your code is very similar to this Django snippet. A comment there suggests using:
<label for="{{ field.auto_id }}">
instead of your:
<label for="id_{{ field.label }}">
You can also try this snippet as an alternative.
0👍
template:
<label for="{{ user_form.first_name.id_for_label }}" class="{{ user_form.first_name.css_classes }}">{{ user_form.first_name.label }}{{ user_form.label_suffix }}</label>
forms.py:
class UserChangeForm(DjangoUserChangeForm):
error_css_class = 'field_error'
required_css_class = 'field_required'
CSS:
.field_required:after {
content: " *";
}
- [Answered ]-Django: Url Mapping vs GET
- [Answered ]-How do I connect a django rest framework json query result to dgrid/OnDemandGrid
- [Answered ]-Get an error while applying a widget to a field
- [Answered ]-Django admin exclude filter
Source:stackexchange.com