I want to put an anchor tag into this ValidationError:
Customer.objects.get(email=value)
if self.register:
# this address is already registered
raise forms.ValidationError(
_('An account already exists for this email address')
)
The anchor tag would be <a href="some/url/to/login">Log in instead</a>
So, the error message when a user inputs an email that already exists would be something like:
'An account already exists for this email address. <a>
Log in instead</a>
?'
Thanks in advance!
This worked:
Customer.objects.get(email=value)
if self.register:
# this address is already registered
raise forms.ValidationError(
(_(mark_safe('An account already exists for this email address. <a href="#" class="email_error">Log in instead?</a>')))
)
...but also needed this at the top of the Python file:
from django.utils.safestring import mark_safe
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