Hello! Has anyone dealt with this before? It seems that my forms don't add
the CSS class to errors raised in model.clean() or model.clean_fields()
methods.
I have a form that looks something like this:
class HttpsFaxBoxForm(forms.ModelForm):
error_css_class = 'form_error'
class Meta:
model = FaxBox
fields = ('outbound_cid_profile', 'id')
And I run validation in my models(keep the admin page consistent) like this:
class FaxBox(models.Model):
something = fields.CharField(max_length=100)
def clean(self):
if self.something == "shouldn't be here":
raise ValidationError('This should not be here! Please fix!')
super().clean_fields(exclude=None)
But when this exception gets raised, the CSS class isn't applied to it in
the template. Anyone know of a way to work around this? Thanks for reading!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/8cfa5a86-ccaf-47f7-8b10-93fbaaaf4386%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.