Commit 799f12e5 authored by Luuk Scholten's avatar Luuk Scholten
Browse files

Set today as exam date by default in upload exam form

parent f768a077
......@@ -6,7 +6,10 @@ from .models import Course, Exam, Summary
class AddExamForm(ModelForm):
exam_date = DateField(widget=SelectDateWidget())
exam_date = DateField(
course = ModelChoiceField(
queryset=Course.objects.order_by('name_' + settings.LANGUAGE_CODE),
import itertools
import os
from datetime import datetime
from datetime import datetime, date
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404, render
......@@ -81,13 +81,12 @@ def submit_exam(request, id=None):
form = AddExamForm()
form.exam_date =
obj = Exam()
obj.exam_date =
if id is not None:
obj.course = Course.objects.get(id=id)
form = AddExamForm(instance=obj)
form.exam_date =
return render(request, 'education/add_exam.html',
{'form': form, 'saved': saved})
Markdown is supported
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