Generic forms: Don't raise, display exceptions
Update the generic single object create and edit views to display critical exceptions instead of just raising them and stoping execution. The should allow removing duplicated exception to message code in subclasses of these views. Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This commit is contained in:
@@ -355,6 +355,9 @@ class SingleObjectCreateView(ObjectNameMixin, ViewPermissionCheckMixin, ExtraCon
|
||||
'error': exception
|
||||
}
|
||||
)
|
||||
return super(
|
||||
SingleObjectCreateView, self
|
||||
).form_invalid(form=form)
|
||||
else:
|
||||
context = self.get_context_data()
|
||||
|
||||
@@ -452,8 +455,9 @@ class SingleObjectEditView(ObjectNameMixin, ViewPermissionCheckMixin, ObjectPerm
|
||||
'error': exception
|
||||
}
|
||||
)
|
||||
|
||||
raise exception
|
||||
return super(
|
||||
SingleObjectEditView, self
|
||||
).form_invalid(form=form)
|
||||
else:
|
||||
messages.success(
|
||||
self.request,
|
||||
|
||||
Reference in New Issue
Block a user