Show error elegantly

This commit is contained in:
PCoder 2019-12-26 13:56:31 +05:30
parent 7eff6fc92c
commit b284ed70a6
2 changed files with 3 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{% if messages %}
<ul class="list-unstyled msg-list">
{% for message in messages %}
<div class="alert {% if message.tags and message.tags == 'error' %} alert-danger {% else %} alert-{{message.tags}} {% endif %}">{{ message|safe }}</div>
<div class="alert {% if message.tags and (message.tags == 'error' or message.tags == 'vat_error') %} alert-danger {% else %} alert-{{message.tags}} {% endif %}">{{ message|safe }}</div>
{% endfor %}
</ul>
{% endif %}

View file

@ -642,7 +642,8 @@ class SettingsView(LoginRequiredMixin, FormView):
)
if 'error' in validate_result and validate_result['error']:
messages.add_message(
request, messages.ERROR, validate_result["error"],
request, messages.ERROR,
"VAT Number validation error: %s" % validate_result["error"],
extra_tags='vat_error'
)
else: