|
@@ -41,6 +41,52 @@ class OrderReg(CreateView):
|
|
|
return True
|
|
|
return False
|
|
|
|
|
|
+class OrderRegUpdateView(UserPassesTestMixin, UpdateView):
|
|
|
+ model = OrdersLocal
|
|
|
+ form_class = OrderRegForm
|
|
|
+ template_name = "SharixAdmin/order_reg.html"
|
|
|
+
|
|
|
+ def get_context_data(self, **kwargs):
|
|
|
+ context = super().get_context_data(**kwargs)
|
|
|
+ context.update({
|
|
|
+ 'title': _('Заявка на экскурсию'),
|
|
|
+ 'object': self.object,
|
|
|
+ "current_page": "order_reg"
|
|
|
+ })
|
|
|
+ return context
|
|
|
+
|
|
|
+
|
|
|
+ def test_func(self) -> bool or None:
|
|
|
+ group_names = ('METASERVICE-ADMIN')
|
|
|
+ if bool(self.request.user.groups.filter(name=group_names)) or self.request.user:
|
|
|
+ return True
|
|
|
+ return False
|
|
|
+
|
|
|
+ def get_success_url(self):
|
|
|
+ return reverse('order_reg')
|
|
|
+
|
|
|
+class OrderRegDelete(UserPassesTestMixin, DeleteView):
|
|
|
+ model = OrdersLocal
|
|
|
+ template_name = "SharixAdmin/order_reg_delete.html"
|
|
|
+
|
|
|
+ def get_context_data(self, **kwargs):
|
|
|
+ context = super().get_context_data(**kwargs)
|
|
|
+ context.update({
|
|
|
+ 'title': 'Заявка на экскурсию',
|
|
|
+ 'object': self.object,
|
|
|
+ "current_page": "order_reg"
|
|
|
+ })
|
|
|
+ return context
|
|
|
+
|
|
|
+ def get_success_url(self):
|
|
|
+ return reverse('order_reg')
|
|
|
+
|
|
|
+ def test_func(self) -> bool or None:
|
|
|
+ group_names = ('METASERVICE-ADMIN')
|
|
|
+ if bool(self.request.user.groups.filter(name=group_names)) or self.request.user.is_superuser:
|
|
|
+ return True
|
|
|
+ return False
|
|
|
+
|
|
|
class OrdersListView(UserPassesTestMixin, SingleTableView):
|
|
|
table_class = OrderList
|
|
|
queryset = OrdersLocal.objects.all()
|