Skip to content

Commit

Permalink
adding codnition for published and closed courses only, changing date…
Browse files Browse the repository at this point in the history
… condition
  • Loading branch information
madlenkk committed Apr 19, 2019
1 parent 2a836f3 commit 0096871
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions registration/management/commands/status_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ def handle(self, *args, **kwargs):

for evt in CourseEvent.objects.all():

if (today - evt.date).days == 0:
evt.status = CourseEvent.PAST
evt.save()

self.stdout.write(
self.style.SUCCESS('Course {} set status to {}'.format(
str(evt), evt.status))
)
if evt.status == CourseEvent.PUBLISHED or evt.status == CourseEvent.CLOSED:

if (today - evt.date).days >= 0:
evt.status = CourseEvent.PAST
evt.save()

self.stdout.write(
self.style.SUCCESS('Course {} set status to {}'.format(
str(evt), evt.status))
)

0 comments on commit 0096871

Please sign in to comment.