43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from django.views.generic import DetailView
|
|
from django.views.generic.base import TemplateView
|
|
from django.views.generic.edit import CreateView
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
|
from django.urls import reverse
|
|
from .models import CaseStudy
|
|
from .forms import ShortCaseStudyForm, LongCaseStudyForm
|
|
|
|
|
|
class Map(TemplateView):
|
|
template_name = "map/index.html"
|
|
|
|
|
|
class Create(LoginRequiredMixin, TemplateView):
|
|
template_name = "map/how_much_time.html"
|
|
|
|
|
|
class BaseForm(LoginRequiredMixin, CreateView):
|
|
"""View for base case study form."""
|
|
template_name = 'map/form.html'
|
|
success_url = '/case-study/create/success/'
|
|
model = CaseStudy
|
|
|
|
|
|
class ShortForm(BaseForm):
|
|
"""View for short version of case study form."""
|
|
form_class = ShortCaseStudyForm
|
|
|
|
|
|
class LongForm(BaseForm):
|
|
"""View for long version of case study form."""
|
|
form_class = LongCaseStudyForm
|
|
|
|
|
|
class FormSuccess(TemplateView):
|
|
template_name = 'map/form-success.html'
|
|
|
|
|
|
class CaseStudyDetail(DetailView):
|
|
template_name = "map/detail.html"
|
|
model = CaseStudy
|
|
context_object_name = "case_study"
|