[UPDT] BASE: Updated base module by adding non field errors in company form html

This commit is contained in:
Horilla
2025-05-10 17:04:00 +05:30
parent 0fafc7c27f
commit 95496dc2b9
3 changed files with 5 additions and 2 deletions

View File

@@ -208,9 +208,11 @@ class ModelForm(forms.ModelForm):
label = ""
if field.label is not None:
label = _(field.label.title())
existing_class = field.widget.attrs.get("class", "oh-input w-100")
field.widget.attrs.update(
{"class": "oh-input w-100", "placeholder": label}
{"class": f"{existing_class}", "placeholder": label}
)
elif isinstance(widget, (forms.Select,)):
field.empty_label = None
if not isinstance(field, forms.ModelMultipleChoiceField):

View File

@@ -70,7 +70,7 @@ class Company(HorillaModel):
Company model
"""
company = models.CharField(max_length=50)
company = models.CharField(max_length=50, verbose_name=_("Name"))
hq = models.BooleanField(default=False)
address = models.TextField(max_length=255)
country = models.CharField(max_length=50)

View File

@@ -17,6 +17,7 @@
{% csrf_token %}
<div class="oh-inner-sidebar-content__body">
<div class="col-12">{{form.non_field_errors}}</div>
<!-- Company Name -->
<div class="oh-input-group mb-2">
<label for="{{ form.company.id_for_label }}" class="mb-1">{{ form.company.label }}</label>