Add registration and login templates plus UI stuff, moderation
This commit is contained in:
@ -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"
|
||||
|
Reference in New Issue
Block a user