Add registration and login templates plus UI stuff, moderation

This commit is contained in:
Livvy Mackintosh
2017-10-08 21:21:51 +01:00
parent f8dc44b4a6
commit 049ca29e77
64 changed files with 18607 additions and 159 deletions

View File

@ -1,12 +1,35 @@
from django.shortcuts import render
from .forms import CaseStudyForm
from django.views.generic import DetailView
from django.views.generic.base import TemplateView
from django.views.generic.edit import FormView
from django.contrib.auth.mixins import LoginRequiredMixin
from .models import CaseStudy
from .forms import ShortCaseStudyForm, LongCaseStudyForm
def index(request):
return render(request, 'map/index.html')
class Map(TemplateView):
template_name = "map/index.html"
def form(request):
form = CaseStudyForm
return render(request, 'map/form.html', {'form': form})
class Create(LoginRequiredMixin, TemplateView):
template_name = "map/how_much_time.html"
class BaseForm(LoginRequiredMixin, FormView):
"""This is the base class for the short and long forms. It handles any shared logic between the two subclasses."""
template_name = 'map/form.html'
class ShortForm(BaseForm):
"""Here, we use the short version of the form."""
form_class = ShortCaseStudyForm
class LongForm(BaseForm):
"""Here, we use the long version of the form."""
form_class = LongCaseStudyForm
class CaseStudyDetail(DetailView):
template_name = "map/detail.html"
model = CaseStudy
context_object_name = "case_study"