From 07f9bed0964894a8e04790a12139f517a6441c56 Mon Sep 17 00:00:00 2001 From: Anna Sidwell Date: Mon, 4 Mar 2019 19:57:47 +0000 Subject: [PATCH] Rename view classes to have more descriptive names --- apps/map/urls.py | 16 +++++++++------- apps/map/views.py | 15 +++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/map/urls.py b/apps/map/urls.py index f6bcfc9..14f976f 100644 --- a/apps/map/urls.py +++ b/apps/map/urls.py @@ -9,17 +9,19 @@ from . import views urlpatterns = [ url(r'^$', RedirectView.as_view(url=reverse_lazy('map')), name='index'), - url(r'^case-study/create/?$', views.Create.as_view(), name="create"), - url(r'^case-study/create/short/?$', views.ShortForm.as_view(), name='short-form'), - url(r'^case-study/create/long/?$', views.LongForm.as_view(), name='long-form'), - url(r'^case-study/create/poi/?$', views.PointOfInterest.as_view(), name='point-of-interest-form'), - url(r'^case-study/create/success/?$', views.FormSuccess.as_view(), name='form-success'), - url(r'^case-study/draft/?$', views.Drafts.as_view(), name='drafts'), - url(r'^case-study/(?P[-\w]+)/?$', views.CaseStudyDetail.as_view(), name='detail'), + url(r'^case-study/create/?$', views.CreateCaseStudySelector.as_view(), name="create"), + url(r'^case-study/create/short/?$', views.CreateShortCaseStudy.as_view(), name='short-form'), + url(r'^case-study/create/long/?$', views.CreateLongCaseStudy.as_view(), name='long-form'), + url(r'^case-study/create/poi/?$', views.CreatePointOfInterest.as_view(), name='point-of-interest-form'), + url(r'^case-study/create/success/?$', views.CreateCaseStudySuccess.as_view(), name='form-success'), url(r'^case-study/edit/(?P[\d]+)/?$', views.EditCaseStudy.as_view(), name='edit'), + + # View case studies + url(r'^case-study/(?P[-\w]+)/?$', views.ViewCaseStudyDetail.as_view(), name='detail'), url(r'^map/?$', views.Map.as_view(), name='map'), # API + url(r'^case-study/draft/?$', views.DraftsAPI.as_view(), name='drafts'), url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalogue'), url(r'^srs-autocomplete/$', views.SpatialRefSysAutocomplete.as_view(), name='srs-autocomplete'), ] diff --git a/apps/map/views.py b/apps/map/views.py index 3dd2b63..964ab76 100644 --- a/apps/map/views.py +++ b/apps/map/views.py @@ -36,11 +36,11 @@ class Map(TemplateView): template_name = "map/index.html" -class Create(LoginRequiredMixin, TemplateView): +class CreateCaseStudySelector(LoginRequiredMixin, TemplateView): template_name = "map/form-selector.html" -class PointOfInterest(LoginRequiredMixin, CreateView): +class CreatePointOfInterest(LoginRequiredMixin, CreateView): """View for base case study form.""" template_name = 'map/form-poi.html' success_url = '/case-study/create/success/' @@ -123,27 +123,26 @@ class BaseCreateForm(LoginRequiredMixin, FilesHandlerMixin, CreateView): delete_user_draft(self.request.user) -class ShortForm(BaseCreateForm): +class CreateShortCaseStudy(BaseCreateForm): """View for short version of case study form.""" form_class = ShortCaseStudyForm -class LongForm(BaseCreateForm): +class CreateLongCaseStudy(BaseCreateForm): """View for long version of case study form.""" form_class = LongCaseStudyForm -class FormSuccess(TemplateView): +class CreateCaseStudySuccess(TemplateView): template_name = 'map/form-success.html' -class CaseStudyDetail(DetailView): +class ViewCaseStudyDetail(DetailView): template_name = "map/detail.html" model = CaseStudy context_object_name = "case_study" - class BaseEditForm(LoginRequiredMixin, FilesHandlerMixin, UpdateView): """View for base case study form.""" template_name = 'map/form-case_study.html' @@ -168,7 +167,7 @@ class SpatialRefSysAutocomplete(autocomplete.Select2QuerySetView): return qs -class Drafts(LoginRequiredMixin, View): +class DraftsAPI(LoginRequiredMixin, View): """Retrieve or save a draft.""" def get_object(self, request):