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 class Map(TemplateView): template_name = "map/index.html" 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"