feat: add consent form for data processing

This commit is contained in:
James Graham
2021-01-20 11:53:08 +00:00
parent f2e945c67f
commit 6dc4bd770f
8 changed files with 99 additions and 6 deletions

View File

@@ -1,13 +1,31 @@
"""
Views belonging to the core of the project.
"""Views belonging to the core of the project.
These views don't represent any of the models in the apps.
"""
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse_lazy
from django.views.generic import TemplateView
from django.views.generic.edit import UpdateView
from . import forms
User = get_user_model() # pylint: disable=invalid-name
class IndexView(TemplateView):
# Template set in Django settings file - may be customised by a customisation app
template_name = settings.TEMPLATE_NAME_INDEX
class ConsentTextView(LoginRequiredMixin, UpdateView):
"""View with consent text and form for users to indicate consent."""
model = User
form_class = forms.ConsentForm
template_name = 'consent.html'
success_url = reverse_lazy('index')
def get_object(self, *args, **kwargs) -> User:
return self.request.user