Skip to content

Commit 99f5bdb

Browse files
authored
Merge pull request #302 from MysteriousCoder7/CalendarCount
Value Error for year = 0 at Calendar
2 parents 6598c61 + 375d8df commit 99f5bdb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

corpus/newsletter/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def calendar_view(request):
3333
month = int(request.GET.get("month", today.month))
3434
if not (1 <= month <= 12):
3535
month = today.month
36+
messages.error(request, "Month out of range")
37+
if year < 1900 or year > today.year+100 :
38+
year = today.year
39+
messages.error(request, "Year out of range")
3640
first_of_month = date(year, month, 1)
3741
except (ValueError, TypeError):
3842
year = today.year
@@ -285,4 +289,4 @@ def delete_announcement(request, pk):
285289
return redirect("newsletter_manage_announcements")
286290
else:
287291
messages.warning(request, "Incorrect Request Method. Contact Administrator")
288-
return redirect("newsletter_manage_announcements")
292+
return redirect("newsletter_manage_announcements")

0 commit comments

Comments
 (0)