This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
2018-11-11 12:41:48 +00:00
|
|
|
"""passbook overview views"""
|
|
|
|
|
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
|
|
from django.views.generic import TemplateView
|
2018-12-10 09:50:19 +00:00
|
|
|
|
2018-12-10 09:49:50 +00:00
|
|
|
from passbook.core.models import Application
|
2018-11-11 12:41:48 +00:00
|
|
|
|
2018-12-10 09:50:19 +00:00
|
|
|
|
2018-11-11 12:41:48 +00:00
|
|
|
class OverviewView(LoginRequiredMixin, TemplateView):
|
|
|
|
"""Overview for logged in user, incase user opens passbook directly
|
|
|
|
and is not being forwarded"""
|
|
|
|
|
|
|
|
template_name = 'overview/index.html'
|
2018-11-16 10:41:14 +00:00
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
2018-11-22 12:12:59 +00:00
|
|
|
kwargs['applications'] = self.request.user.applications.all()
|
2018-12-10 09:49:50 +00:00
|
|
|
if self.request.user.is_superuser:
|
|
|
|
kwargs['applications'] = Application.objects.all()
|
2018-11-16 10:41:14 +00:00
|
|
|
return super().get_context_data(**kwargs)
|