start taking more advantage of class based views
This commit is contained in:
@@ -131,6 +131,9 @@ class Long(QuestionBase):
|
||||
|
||||
# question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
||||
|
||||
def get_app_name(self):
|
||||
return "longs"
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse("longs:question_detail", kwargs={"pk": self.pk})
|
||||
|
||||
@@ -472,6 +475,9 @@ class Exam(ExamBase):
|
||||
|
||||
examcollection = models.ForeignKey(ExamCollection, blank=True, null=True, on_delete=models.SET_NULL, related_name="longs_exams")
|
||||
|
||||
def get_app_name(self):
|
||||
return "longs"
|
||||
|
||||
def get_exam_question_json(self, question_id):
|
||||
q = get_object_or_404(Long, pk=question_id)
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
{% extends 'longs/exams.html' %}
|
||||
|
||||
{% block navigation %}
|
||||
{{ block.super }}
|
||||
{% include 'generic/exam_overview_headers.html' %}
|
||||
{% endblock navigation %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% load thumbnail %}
|
||||
<div class="longs">
|
||||
{% include 'generic/exam_overview_headers.html' %}
|
||||
|
||||
|
||||
<ol id="full-question-list" class="sortable">
|
||||
|
||||
+4
-3
@@ -13,7 +13,7 @@ from django.core.exceptions import (
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.views.generic.detail import DetailView
|
||||
from generic.mixins import SuperuserRequiredMixin
|
||||
from generic.mixins import CheckCanEditMixin, SuperuserRequiredMixin
|
||||
|
||||
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
||||
from django.views.generic import ListView
|
||||
@@ -1130,7 +1130,7 @@ class ExamCreate(ExamCreateBase):
|
||||
form_class = ExamForm
|
||||
|
||||
|
||||
class ExamUpdate(ExamUpdateBase, AuthorOrCheckerRequiredMixin):
|
||||
class ExamUpdate(CheckCanEditMixin, ExamUpdateBase, AuthorOrCheckerRequiredMixin):
|
||||
model = Exam
|
||||
form_class = ExamForm
|
||||
|
||||
@@ -1142,9 +1142,10 @@ class ExamClone(ExamCloneMixin, ExamCreate):
|
||||
"""Clone exam view"""
|
||||
|
||||
|
||||
class ExamAuthorUpdate(RevisionMixin, LoginRequiredMixin, AuthorRequiredMixin, UpdateView):
|
||||
class ExamAuthorUpdate(RevisionMixin, CheckCanEditMixin, LoginRequiredMixin, AuthorRequiredMixin, UpdateView):
|
||||
model = Exam
|
||||
form_class = ExamAuthorForm
|
||||
template_name = "author_form.html"
|
||||
|
||||
|
||||
#class ExamViewSet(RevisionMixin, viewsets.ModelViewSet):
|
||||
|
||||
Reference in New Issue
Block a user