IdHub/idhub/user/views.py

76 lines
2 KiB
Python
Raw Normal View History

2023-10-10 08:54:13 +00:00
import logging
from django.utils.translation import gettext_lazy as _
2023-10-11 07:52:05 +00:00
from django.views.generic.edit import UpdateView
from django.views.generic.base import TemplateView
2023-10-10 08:54:13 +00:00
from django.urls import reverse_lazy
from django.contrib import messages
2023-10-11 07:52:05 +00:00
from idhub.user.forms import ProfileForm
2023-10-10 08:54:13 +00:00
from idhub.mixins import UserView
class MyProfile(UserView):
title = _("My profile")
section = "MyProfile"
2023-10-11 07:52:05 +00:00
class MyWallet(UserView, TemplateView):
2023-10-10 08:54:13 +00:00
title = _("My Wallet")
section = "MyWallet"
2023-10-11 07:52:05 +00:00
class UserDashboardView(UserView, TemplateView):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/dashboard.html"
2023-10-10 08:54:13 +00:00
title = _('Dashboard')
subtitle = _('Success')
icon = 'bi bi-bell'
section = "Home"
2023-10-11 07:52:05 +00:00
class UserProfileView(MyProfile, UpdateView):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/profile.html"
2023-10-10 08:54:13 +00:00
subtitle = _('My personal Data')
icon = 'bi bi-person'
2023-10-11 07:52:05 +00:00
from_class = ProfileForm
fields = ('first_name', 'last_name', 'email')
success_url = reverse_lazy('idhub:user_profile')
2023-10-10 08:54:13 +00:00
2023-10-11 07:52:05 +00:00
def get_object(self):
return self.request.user
2023-10-10 08:54:13 +00:00
2023-10-11 07:52:05 +00:00
class UserRolesView(MyProfile, TemplateView):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/roles.html"
2023-10-10 08:54:13 +00:00
subtitle = _('My roles')
icon = 'fa-brands fa-critical-role'
2023-10-11 07:52:05 +00:00
class UserGDPRView(MyProfile, TemplateView):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/gdpr.html"
2023-10-10 08:54:13 +00:00
subtitle = _('GDPR info')
icon = 'bi bi-file-earmark-medical'
class UserIdentitiesView(MyWallet):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/identities.html"
2023-10-10 08:54:13 +00:00
subtitle = _('Identities (DID)')
icon = 'bi bi-patch-check-fill'
class UserCredentialsView(MyWallet):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/credentials.html"
2023-10-10 08:54:13 +00:00
subtitle = _('Credentials')
icon = 'bi bi-patch-check-fill'
class UserCredentialsRequiredView(MyWallet):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/credentials_required.html"
2023-10-10 08:54:13 +00:00
subtitle = _('Credentials required')
icon = 'bi bi-patch-check-fill'
class UserCredentialsPresentationView(MyWallet):
2023-10-17 15:42:48 +00:00
template_name = "idhub/user/credentials_presentation.html"
2023-10-10 08:54:13 +00:00
subtitle = _('Credentials Presentation')
icon = 'bi bi-patch-check-fill'