diff --git a/ddm/auth/tests/test_views.py b/ddm/auth/tests/test_views.py index 7cc2ae6..6e306ca 100644 --- a/ddm/auth/tests/test_views.py +++ b/ddm/auth/tests/test_views.py @@ -5,7 +5,7 @@ from django.contrib.auth import get_user_model from django.views.generic import TemplateView -from ddm.auth.views import DdmAuthMixin +from ddm.auth.views import DDMAuthMixin from ddm.projects.models import ResearchProfile, DonationProject User = get_user_model() @@ -86,7 +86,7 @@ def test_redirect_if_anonymous(self): self.assertRedirects(response, reverse('ddm_login')) -class TestView(DdmAuthMixin, TemplateView): +class TestView(DDMAuthMixin, TemplateView): template_name = 'auth/no_permission.html' diff --git a/ddm/auth/views.py b/ddm/auth/views.py index 5a12b6b..c1dc235 100644 --- a/ddm/auth/views.py +++ b/ddm/auth/views.py @@ -14,7 +14,7 @@ User = get_user_model() -class DdmAuthMixin: +class DDMAuthMixin: """ Mixin for Class Based Views that handles redirects as follows: - unauthenticated users => login page. @@ -71,7 +71,7 @@ def dispatch(self, request, *args, **kwargs): return super().dispatch(request, *args, **kwargs) -class ProjectTokenView(SuccessMessageMixin, DdmAuthMixin, FormView): +class ProjectTokenView(SuccessMessageMixin, DDMAuthMixin, FormView): """ View to see existing access token or generate a new one. """ template_name = 'auth/token.html' form_class = TokenCreationForm diff --git a/ddm/datadonation/views.py b/ddm/datadonation/views.py index e471e6e..e25cfbb 100644 --- a/ddm/datadonation/views.py +++ b/ddm/datadonation/views.py @@ -9,7 +9,7 @@ from ddm.datadonation.forms import BlueprintEditForm, ProcessingRuleInlineFormset from ddm.datadonation.models import DonationBlueprint, DonationInstruction, FileUploader from ddm.projects.models import DonationProject -from ddm.projects.views import DdmAuthMixin +from ddm.projects.views import DDMAuthMixin class BlueprintMixin: @@ -28,7 +28,7 @@ def get_success_url(self): kwargs={'project_pk': self.kwargs['project_pk']}) -class DataDonationOverview(DdmAuthMixin, BlueprintMixin, ListView): +class DataDonationOverview(DDMAuthMixin, BlueprintMixin, ListView): """ View to list all file uploaders associated with a project. """ model = FileUploader context_object_name = 'file_uploaders' @@ -44,7 +44,7 @@ def get_queryset(self): return queryset -class FileUploaderCreate(SuccessMessageMixin, DdmAuthMixin, BlueprintMixin, CreateView): +class FileUploaderCreate(SuccessMessageMixin, DDMAuthMixin, BlueprintMixin, CreateView): """ View to create a new file uploader. """ model = FileUploader template_name = 'datadonation/uploader/create.html' @@ -63,7 +63,7 @@ def get_success_url(self): return reverse('datadonation:uploaders:edit', kwargs=kwargs) -class FileUploaderEdit(SuccessMessageMixin, DdmAuthMixin, BlueprintMixin, UpdateView): +class FileUploaderEdit(SuccessMessageMixin, DDMAuthMixin, BlueprintMixin, UpdateView): """ View to edit the details of an existing file uploader. """ model = FileUploader template_name = 'datadonation/uploader/edit.html' @@ -113,7 +113,7 @@ def form_valid(self, form, selected_blueprints): return HttpResponseRedirect(self.get_success_url()) -class FileUploaderDelete(SuccessMessageMixin, DdmAuthMixin, BlueprintMixin, DeleteView): +class FileUploaderDelete(SuccessMessageMixin, DDMAuthMixin, BlueprintMixin, DeleteView): """ View to delete an existing blueprint uploader. """ model = FileUploader template_name = 'datadonation/uploader/delete.html' @@ -123,7 +123,7 @@ def get_success_message(self, cleaned_data): return self.success_message % self.object.name -class BlueprintCreate(SuccessMessageMixin, DdmAuthMixin, BlueprintMixin, CreateView): +class BlueprintCreate(SuccessMessageMixin, DDMAuthMixin, BlueprintMixin, CreateView): """ View to create a new donation blueprint. """ model = DonationBlueprint template_name = 'datadonation/blueprint/create.html' @@ -145,7 +145,7 @@ def get_success_url(self): kwargs={'project_pk': self.object.project.pk, 'pk': self.object.pk}) -class BlueprintEdit(SuccessMessageMixin, DdmAuthMixin, BlueprintMixin, UpdateView): +class BlueprintEdit(SuccessMessageMixin, DDMAuthMixin, BlueprintMixin, UpdateView): """ View to edit the details of an existing donation blueprint. """ model = DonationBlueprint template_name = 'datadonation/blueprint/edit.html' @@ -187,7 +187,7 @@ def form_invalid(self, form, formset): return self.render_to_response(self.get_context_data(form=form, formset=formset)) -class BlueprintDelete(SuccessMessageMixin, DdmAuthMixin, BlueprintMixin, DeleteView): +class BlueprintDelete(SuccessMessageMixin, DDMAuthMixin, BlueprintMixin, DeleteView): """ View to delete an existing donation blueprint. """ model = DonationBlueprint template_name = 'datadonation/blueprint/delete.html' @@ -210,7 +210,7 @@ def get_success_url(self): return reverse('datadonation:instructions:overview', kwargs=kwargs) -class InstructionOverview(DdmAuthMixin, InstructionMixin, ListView): +class InstructionOverview(DDMAuthMixin, InstructionMixin, ListView): """ View to create a new instruction page. """ model = DonationInstruction context_object_name = 'instructions' @@ -222,7 +222,7 @@ def get_queryset(self): return queryset -class InstructionCreate(SuccessMessageMixin, DdmAuthMixin, InstructionMixin, CreateView): +class InstructionCreate(SuccessMessageMixin, DDMAuthMixin, InstructionMixin, CreateView): """ View to create an instruction page. """ model = DonationInstruction template_name = 'datadonation/instructions/create.html' @@ -245,7 +245,7 @@ def get_initial(self): return initial -class InstructionEdit(SuccessMessageMixin, DdmAuthMixin, InstructionMixin, UpdateView): +class InstructionEdit(SuccessMessageMixin, DDMAuthMixin, InstructionMixin, UpdateView): """ View to edit an instruction page. """ model = DonationInstruction template_name = 'datadonation/instructions/edit.html' @@ -253,7 +253,7 @@ class InstructionEdit(SuccessMessageMixin, DdmAuthMixin, InstructionMixin, Updat success_message = 'Instruction page was successfully updated.' -class InstructionDelete(SuccessMessageMixin, DdmAuthMixin, InstructionMixin, DeleteView): +class InstructionDelete(SuccessMessageMixin, DDMAuthMixin, InstructionMixin, DeleteView): """ View to delete an instruction page. """ model = DonationInstruction template_name = 'datadonation/instructions/delete.html' diff --git a/ddm/logging/views.py b/ddm/logging/views.py index add56ee..d473cf6 100644 --- a/ddm/logging/views.py +++ b/ddm/logging/views.py @@ -1,11 +1,11 @@ from django.contrib.messages.views import SuccessMessageMixin from django.views.generic import TemplateView -from ddm.auth.views import DdmAuthMixin +from ddm.auth.views import DDMAuthMixin from ddm.projects.models import DonationProject -class ProjectLogsView(SuccessMessageMixin, DdmAuthMixin, TemplateView): +class ProjectLogsView(SuccessMessageMixin, DDMAuthMixin, TemplateView): """ View that lists all exceptions related to a project. """ template_name = 'logging/overview.html' diff --git a/ddm/projects/views.py b/ddm/projects/views.py index 47ea445..c05e694 100644 --- a/ddm/projects/views.py +++ b/ddm/projects/views.py @@ -6,10 +6,10 @@ from ddm.projects.forms import ProjectCreateForm, ProjectEditForm, BriefingEditForm, DebriefingEditForm from ddm.projects.models import DonationProject, ResearchProfile -from ddm.auth.views import DdmAuthMixin +from ddm.auth.views import DDMAuthMixin -class ProjectList(DdmAuthMixin, ListView): +class ProjectList(DDMAuthMixin, ListView): """ View to display a list of existing donation projects. """ model = DonationProject template_name = 'projects/list.html' @@ -18,7 +18,7 @@ def get_queryset(self): return DonationProject.objects.filter(owner__user=self.request.user) -class ProjectCreate(SuccessMessageMixin, DdmAuthMixin, CreateView): +class ProjectCreate(SuccessMessageMixin, DDMAuthMixin, CreateView): """ View to create a new donation project. """ model = DonationProject template_name = 'projects/create.html' @@ -35,13 +35,13 @@ def form_valid(self, form): return super().form_valid(form) -class ProjectDetail(DdmAuthMixin, DetailView): +class ProjectDetail(DDMAuthMixin, DetailView): """ View to display landing page for project. """ model = DonationProject template_name = 'projects/detail.html' -class ProjectEdit(SuccessMessageMixin, DdmAuthMixin, UpdateView): +class ProjectEdit(SuccessMessageMixin, DDMAuthMixin, UpdateView): """ View to edit the details of an existing donation project. """ model = DonationProject template_name = 'projects/edit.html' @@ -49,7 +49,7 @@ class ProjectEdit(SuccessMessageMixin, DdmAuthMixin, UpdateView): success_message = 'Project details successfully updated.' -class ProjectDelete(SuccessMessageMixin, DdmAuthMixin, DeleteView): +class ProjectDelete(SuccessMessageMixin, DDMAuthMixin, DeleteView): """ View to display a list of existing donation projects. """ model = DonationProject template_name = 'projects/delete.html' @@ -60,7 +60,7 @@ def get_success_message(self, cleaned_data): return self.success_message % self.object.name -class BriefingEdit(SuccessMessageMixin, DdmAuthMixin, UpdateView): +class BriefingEdit(SuccessMessageMixin, DDMAuthMixin, UpdateView): """ View to edit the briefing page. """ model = DonationProject template_name = 'projects/edit-briefing.html' @@ -68,7 +68,7 @@ class BriefingEdit(SuccessMessageMixin, DdmAuthMixin, UpdateView): success_message = 'Briefing page successfully updated.' -class DebriefingEdit(SuccessMessageMixin, DdmAuthMixin, UpdateView): +class DebriefingEdit(SuccessMessageMixin, DDMAuthMixin, UpdateView): """ View to edit the debriefing page. """ model = DonationProject template_name = 'projects/edit-debriefing.html' diff --git a/ddm/questionnaire/views.py b/ddm/questionnaire/views.py index 26dab19..b29dc92 100644 --- a/ddm/questionnaire/views.py +++ b/ddm/questionnaire/views.py @@ -6,7 +6,7 @@ from django_ckeditor_5.widgets import CKEditor5Widget -from ddm.auth.views import DdmAuthMixin +from ddm.auth.views import DDMAuthMixin from ddm.datadonation.models import DonationBlueprint from ddm.projects.models import DonationProject from ddm.questionnaire.models import ( @@ -28,7 +28,7 @@ def get_project(self): return DonationProject.objects.get(pk=self.kwargs['project_pk']) -class QuestionnaireOverview(ProjectMixin, DdmAuthMixin, ListView): +class QuestionnaireOverview(ProjectMixin, DDMAuthMixin, ListView): """ View to list all donation blueprints associated with a project. """ model = DonationBlueprint context_object_name = 'donation_blueprints' @@ -90,7 +90,7 @@ def get_context_data(self, **kwargs): return context -class QuestionCreate(SuccessMessageMixin, DdmAuthMixin, QuestionFormMixin, CreateView): +class QuestionCreate(SuccessMessageMixin, DDMAuthMixin, QuestionFormMixin, CreateView): """ View to create question. """ template_name = 'questionnaire/create.html' success_message = 'New %(question_type)s was created.' @@ -122,7 +122,7 @@ def get_success_message(self, cleaned_data): ) -class QuestionEdit(SuccessMessageMixin, DdmAuthMixin, QuestionFormMixin, UpdateView): +class QuestionEdit(SuccessMessageMixin, DDMAuthMixin, QuestionFormMixin, UpdateView): """ View to edit question. """ model = QuestionBase template_name = 'questionnaire/edit.html' @@ -137,7 +137,7 @@ def get_success_url(self): return reverse('questionnaire:edit', kwargs=success_kwargs) -class QuestionDelete(SuccessMessageMixin, DdmAuthMixin, ProjectMixin, DeleteView): +class QuestionDelete(SuccessMessageMixin, DDMAuthMixin, ProjectMixin, DeleteView): """ View to delete question. """ model = QuestionBase template_name = 'questionnaire/delete.html' @@ -189,7 +189,7 @@ def get_excluded_fields(self): return excluded_fields -class ItemEdit(SuccessMessageMixin, DdmAuthMixin, InlineFormsetMixin, UpdateView): +class ItemEdit(SuccessMessageMixin, DDMAuthMixin, InlineFormsetMixin, UpdateView): """ View to edit the items associated with a question. """ model = QuestionBase formset_model = QuestionItem @@ -207,7 +207,7 @@ def get_success_url(self): return reverse('questionnaire:items', kwargs=success_kwargs) -class ScaleEdit(SuccessMessageMixin, DdmAuthMixin, InlineFormsetMixin, UpdateView): +class ScaleEdit(SuccessMessageMixin, DDMAuthMixin, InlineFormsetMixin, UpdateView): """ View to edit the scale associated with a question. """ model = QuestionBase formset_model = ScalePoint