Esempio n. 1
0
 def get_context_data(self, **kwargs):
     context = super(ReportView, self).get_context_data(**kwargs)
     context['page_title'] = ' | '.join([settings.APPLICATION_ACRONYM, 'Reports'])
     links = [(reverse('site_home'), 'Home'), (None, 'Reports')]
     context['breadcrumb_trail'] = breadcrumbs_li(links)
     context['no_sidebar'] = True
     context['is_prs_user'] = prs_user(self.request)
     return context
Esempio n. 2
0
 def get_context_data(self, **kwargs):
     context = super(ReportView, self).get_context_data(**kwargs)
     context['page_title'] = ' | '.join(
         [settings.APPLICATION_ACRONYM, 'Reports'])
     links = [(reverse('site_home'), 'Home'), (None, 'Reports')]
     context['breadcrumb_trail'] = breadcrumbs_li(links)
     context['no_sidebar'] = True
     context['is_prs_user'] = prs_user(self.request)
     return context
Esempio n. 3
0
    def dispatch(self, request, *args, **kwargs):
        if not prs_user(request):
            messages.warning(request, '''You do not have permission to edit data.
            Please contact the application owner(s): {}'''.format(', '.join([i[0] for i in settings.MANAGERS])))
            return HttpResponseRedirect(reverse('site_home'))

        # kwargs must include a Model class, or a string.
        if 'model' in kwargs:
            self.model = is_model_or_string(kwargs['model'])
        return super(PrsObjectCreate, self).dispatch(request, *args, **kwargs)
Esempio n. 4
0
    def dispatch(self, request, *args, **kwargs):
        if not prs_user(request):
            messages.warning(
                request,
                """You do not have permission to edit data.
            Please contact the application owner(s): {}""".format(", ".join(
                    [i[0] for i in settings.MANAGERS])),
            )
            return HttpResponseRedirect(reverse("site_home"))

        # kwargs must include a Model class, or a string.
        if "model" in kwargs:
            self.model = is_model_or_string(kwargs["model"])
        return super().dispatch(request, *args, **kwargs)