Commit dbdcf557 authored by Julien Palard's avatar Julien Palard
Browse files

No longer needed, we're using the API to add answers.

parent f0007a08
......@@ -25,7 +25,6 @@ from website.views import (
ExerciseListView,
ExerciseView,
about,
AnswerCreateView,
StatsDetailView,
StatsListView,
)
......@@ -43,7 +42,6 @@ urlpatterns = [
path("dashboard/", dashboard_view, name="dashboard"),
path("exercises/", ExerciseListView.as_view(), name="exercises"),
path("favicon.ico", favicon_view),
path("answer/create", AnswerCreateView.as_view(), name="answer-create"),
path("exercises/<slug:slug>", ExerciseView.as_view(), name="exercise"),
path("profile/<int:pk>", ProfileView.as_view(), name="profile"),
path("stats/", StatsListView.as_view(), name="stats"),
......
......@@ -13,10 +13,3 @@ class AnswerForm(forms.ModelForm):
),
"exercise": forms.HiddenInput(),
}
def save(self, commit=True):
instance = super(AnswerForm, self).save(commit=False)
instance.user = self.cleaned_data["user"]
if commit:
instance.save()
return instance
......@@ -109,17 +109,6 @@ class ExerciseView(LoginRequiredMixin, DetailView):
return context
class AnswerCreateView(LoginRequiredMixin, CreateView):
model = Answer
form_class = AnswerForm
template_name = "hkis/answer_form.html"
def form_valid(self, form):
form.cleaned_data["user"] = self.request.user
super().form_valid(form)
return HttpResponse("OK")
class StatsListView(UserPassesTestMixin, ListView):
template_name = "hkis/stats_list.html"
model = Group
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment