You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_django/preinfo/views/employee_views.py

20 lines
864 B
Python

from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.views.generic import TemplateView, FormView, CreateView, ListView
from preinfo.forms import PreinfoBaseForm, PreinfoCreateForm, PreinfoEditForm
from preinfo.models import Preinfo
class EmployeePreinfoView(LoginRequiredMixin, UserPassesTestMixin, ListView):
model = Preinfo
template_name = 'employee/preinfo-list.html'
context_object_name = 'objects'
paginate_by = 30
form_class = PreinfoEditForm
base_template = 'employee-base.html'
def test_func(self):
return True # self.request.user.has_employee_perm('can_view_preinfo') or self.request.user.user_type == 'CA'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['base_template'] = self.base_template
return context