Edward
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
13 additions and
0 deletions
-
sapl/base/views.py
|
@ -1958,6 +1958,19 @@ class AppConfigCrud(CrudAux): |
|
|
self.gerar_hash(prop) |
|
|
self.gerar_hash(prop) |
|
|
return super().form_valid(form) |
|
|
return super().form_valid(form) |
|
|
|
|
|
|
|
|
|
|
|
def form_invalid(self, form): |
|
|
|
|
|
errors_tuple = [(form[e].label, form.errors[e]) |
|
|
|
|
|
for e in form.errors if e in form.fields] |
|
|
|
|
|
error_message = '<ul>' |
|
|
|
|
|
for e in errors_tuple: |
|
|
|
|
|
error_message += '<li><b>%s</b>: %s</li>' % (e[0], e[1][0]) |
|
|
|
|
|
for e in form.non_field_errors(): |
|
|
|
|
|
error_message += '<li>%s</li>' % e |
|
|
|
|
|
error_message += '</ul>' |
|
|
|
|
|
|
|
|
|
|
|
messages.add_message(self.request, messages.ERROR, error_message) |
|
|
|
|
|
return super().form_invalid(form) |
|
|
|
|
|
|
|
|
def gerar_hash(self, inst): |
|
|
def gerar_hash(self, inst): |
|
|
inst.save() |
|
|
inst.save() |
|
|
if inst.texto_original: |
|
|
if inst.texto_original: |
|
|