|
1 |
from authentic2_journal.logger import LoggerHub
|
1 |
2 |
from django_rbac.utils import get_ou_model
|
2 |
3 |
from django.http import HttpResponseRedirect
|
3 |
4 |
from django.contrib import messages
|
... | ... | |
6 |
7 |
from . import tables, views, forms
|
7 |
8 |
|
8 |
9 |
|
|
10 |
journal = LoggerHub()
|
|
11 |
|
|
12 |
|
9 |
13 |
class OrganizationalUnitView(views.BaseTableView):
|
10 |
14 |
template_name = 'authentic2/manager/ous.html'
|
11 |
15 |
model = get_ou_model()
|
... | ... | |
23 |
27 |
form_class = forms.OUEditForm
|
24 |
28 |
title = _('Add organizational unit')
|
25 |
29 |
|
|
30 |
def form_valid(self, form):
|
|
31 |
response = super(OrganizationalUnitAddView, self).form_valid(form)
|
|
32 |
journal.record_creation(self.request.user, self.object)
|
|
33 |
return response
|
|
34 |
|
26 |
35 |
def get_success_url(self):
|
27 |
36 |
return '..'
|
28 |
37 |
|
... | ... | |
53 |
62 |
template_name = 'authentic2/manager/ou_edit.html'
|
54 |
63 |
title = _('Edit organizational unit')
|
55 |
64 |
|
|
65 |
def form_valid(self, form):
|
|
66 |
response = super(OrganizationalUnitEditView, self).form_valid(form)
|
|
67 |
journal.record_update(self.request.user, self.object)
|
|
68 |
return response
|
|
69 |
|
56 |
70 |
edit = OrganizationalUnitEditView.as_view()
|
57 |
71 |
|
58 |
72 |
|
... | ... | |
73 |
87 |
return super(OrganizationalUnitDeleteView, self).dispatch(request, *args,
|
74 |
88 |
**kwargs)
|
75 |
89 |
|
|
90 |
def form_valid(self, form):
|
|
91 |
response = super(OrganizationalUnitDeleteView, self).form_valid(form)
|
|
92 |
journal.record_deletion(self.request.user, self.object)
|
|
93 |
return response
|
|
94 |
|
76 |
95 |
delete = OrganizationalUnitDeleteView.as_view()
|
77 |
|
-
|