Skip to content

Commit

Permalink
make reporter default to None
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tordoff committed Oct 11, 2024
1 parent c88faf7 commit a68886a
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions admin/management/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,10 @@ def post(self, request, *args, **kwargs):
monthly_report_date = request.POST.get('monthly_report_date', None)
if monthly_report_date:
report_date = isoparse(monthly_report_date).date()
else:
messages.error(request, 'Monthly Reporter can\'t be run in future or current month')
return redirect(reverse('management:commands'))

today = datetime.date.today()

if report_date >= today.replace(day=1):
messages.error(request, 'Monthly Reporter can\'t be run for the current or a future month.')
return redirect(reverse('management:commands'))

errors = monthly_reporters_go(
report_month=report_date.month,
report_year=report_date.year
report_month=getattr(report_date, 'month', None),
report_year=getattr(report_date, 'year', None)
)

if errors:
Expand Down

0 comments on commit a68886a

Please sign in to comment.