Skip to content
Snippets Groups Projects
Commit 75e0ccf8 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

fixed addnote command when index is needed (multiple timeslots per show and day)

parent a9e243c9
Branches
Tags
No related merge requests found
...@@ -17,6 +17,9 @@ class Command(BaseCommand): ...@@ -17,6 +17,9 @@ class Command(BaseCommand):
start_date = args[1] start_date = args[1]
status = args[2] status = args[2]
elif len(args) == 4: elif len(args) == 4:
show_id = args[0]
start_date = args[1]
status = args[2]
index = args[3] index = args[3]
else: else:
raise CommandError('you must provide the show_id, start_date, status [index]') raise CommandError('you must provide the show_id, start_date, status [index]')
...@@ -41,7 +44,7 @@ class Command(BaseCommand): ...@@ -41,7 +44,7 @@ class Command(BaseCommand):
if not index: if not index:
raise CommandError('you must provide the show_id, start_date, status index') raise CommandError('you must provide the show_id, start_date, status index')
try: try:
timeslot = TimeSlot.objects.filter(show=show, start__year=year, start__month=month, start__day=day).order_by('start')[index] timeslot = TimeSlot.objects.filter(show=show, start__year=year, start__month=month, start__day=day).order_by('start')[int(index)]
except IndexError as ie: except IndexError as ie:
raise CommandError(ie) raise CommandError(ie)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment