|
|
@@ -83,7 +83,7 @@ def addcount(request):
|
|
83
|
83
|
if request.method == 'POST':
|
|
84
|
84
|
# create a form instance and populate it with data from the request:
|
|
85
|
85
|
form = addCountForm(request.POST)
|
|
86
|
|
- form.fields["lesson"].queryset = Lesson.objects.filter(date__lt=datetime.now()+timedelta(7)).order_by('-date')
|
|
|
86
|
+ form.fields["lesson"].queryset = Lesson.objects.filter(date__lte=datetime.now()).order_by('-date')
|
|
87
|
87
|
# check whether it's valid:
|
|
88
|
88
|
if form.is_valid():
|
|
89
|
89
|
count = form.save()
|
|
|
@@ -91,6 +91,6 @@ def addcount(request):
|
|
91
|
91
|
# if a GET (or any other method) we'll create a blank form
|
|
92
|
92
|
else:
|
|
93
|
93
|
form = addCountForm()
|
|
94
|
|
- form.fields["lesson"].queryset = Lesson.objects.all().order_by('-date')
|
|
|
94
|
+ form.fields["lesson"].queryset = Lesson.objects.filter(date__lte=datetime.now()).order_by('-date')
|
|
95
|
95
|
|
|
96
|
96
|
return render(request, 'addcountTemplate.html', {'form': form})
|