1
0
Fork 0

Prevent observations from being scheduled in the past

If a user opens a schedule page and calculates the observation but let it sit beyond the time that the observation would have happened it is possible to submit an observation in the past.

This change fixes that. Fixes librespacefoundation/satnogs/satnogs-network#422
merge-requests/453/head
Corey Shields 2017-12-26 14:25:33 -05:00
parent 9695601e29
commit 15bcb0f6f7
1 changed files with 4 additions and 0 deletions

View File

@ -224,6 +224,10 @@ def observation_new(request):
messages.error(request, 'Please use the datetime dialogs to submit valid timeframe.')
return redirect(reverse('base:observation_new'))
if (start_time < datetime.now()):
messages.error(request, 'Please schedule an observation that begins in the future')
return redirect(reverse('base:observation_new'))
start = make_aware(start_time, utc)
end = make_aware(end_time, utc)
sat = Satellite.objects.get(norad_cat_id=sat_id)