2017-10-08 20:21:51 +00:00
|
|
|
from django.views.generic import DetailView
|
|
|
|
from django.views.generic.base import TemplateView
|
2017-10-09 23:58:36 +00:00
|
|
|
from django.views.generic.edit import CreateView
|
2017-10-08 20:21:51 +00:00
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
2017-10-09 23:58:36 +00:00
|
|
|
from django.urls import reverse
|
2017-10-08 20:21:51 +00:00
|
|
|
from .models import CaseStudy
|
|
|
|
from .forms import ShortCaseStudyForm, LongCaseStudyForm
|
2017-05-20 23:47:14 +00:00
|
|
|
|
2017-06-16 16:06:22 +00:00
|
|
|
|
2017-10-08 20:21:51 +00:00
|
|
|
class Map(TemplateView):
|
|
|
|
template_name = "map/index.html"
|
2017-05-20 23:47:14 +00:00
|
|
|
|
2017-06-16 16:06:22 +00:00
|
|
|
|
2017-10-08 20:21:51 +00:00
|
|
|
class Create(LoginRequiredMixin, TemplateView):
|
|
|
|
template_name = "map/how_much_time.html"
|
2017-06-16 16:06:22 +00:00
|
|
|
|
2017-10-08 20:21:51 +00:00
|
|
|
|
2017-10-09 23:58:36 +00:00
|
|
|
class BaseForm(LoginRequiredMixin, CreateView):
|
|
|
|
"""View for base case study form."""
|
2017-10-08 20:21:51 +00:00
|
|
|
template_name = 'map/form.html'
|
2018-03-28 07:16:13 +00:00
|
|
|
success_url = '/case-study/create/success/'
|
2017-10-09 23:58:36 +00:00
|
|
|
model = CaseStudy
|
2017-10-08 20:21:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ShortForm(BaseForm):
|
2017-10-09 23:58:36 +00:00
|
|
|
"""View for short version of case study form."""
|
2017-10-08 20:21:51 +00:00
|
|
|
form_class = ShortCaseStudyForm
|
|
|
|
|
|
|
|
|
|
|
|
class LongForm(BaseForm):
|
2017-10-09 23:58:36 +00:00
|
|
|
"""View for long version of case study form."""
|
2017-10-08 20:21:51 +00:00
|
|
|
form_class = LongCaseStudyForm
|
|
|
|
|
|
|
|
|
2017-10-09 23:58:36 +00:00
|
|
|
class FormSuccess(TemplateView):
|
|
|
|
template_name = 'map/form-success.html'
|
|
|
|
|
|
|
|
|
2017-10-08 20:21:51 +00:00
|
|
|
class CaseStudyDetail(DetailView):
|
|
|
|
template_name = "map/detail.html"
|
|
|
|
model = CaseStudy
|
|
|
|
context_object_name = "case_study"
|