mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Improve journal removing
This commit is contained in:
parent
5f9ec9a2ab
commit
5932aad9fa
@ -239,6 +239,12 @@ class JournalDeleteView(CanEditPropMixin, DeleteView):
|
|||||||
template_name = 'core/delete_confirm.jinja'
|
template_name = 'core/delete_confirm.jinja'
|
||||||
success_url = reverse_lazy('accounting:club_details')
|
success_url = reverse_lazy('accounting:club_details')
|
||||||
|
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
self.object = self.get_object()
|
||||||
|
if self.object.operations.count() == 0:
|
||||||
|
return super(JournalDeleteView, self).dispatch(request, *args, **kwargs)
|
||||||
|
else:
|
||||||
|
raise PermissionDenied
|
||||||
|
|
||||||
# Operation views
|
# Operation views
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user