diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2014-01-07 13:39:29 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2014-01-07 13:39:29 (GMT) |
commit | 75e0ccf888f21e11baee743a52641f235bbf24e0 (patch) | |
tree | c9566bef627f12e02f0f7c15c03d09a1ea05873d | |
parent | a9e243c93c09be3800a4a1cde0c1a488bfcf3047 (diff) |
fixed addnote command when index is needed (multiple timeslots per show and day)
-rw-r--r-- | program/management/commands/addnote.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/program/management/commands/addnote.py b/program/management/commands/addnote.py index f418e6e..01d891e 100644 --- a/program/management/commands/addnote.py +++ b/program/management/commands/addnote.py @@ -17,6 +17,9 @@ class Command(BaseCommand): start_date = args[1] status = args[2] elif len(args) == 4: + show_id = args[0] + start_date = args[1] + status = args[2] index = args[3] else: raise CommandError('you must provide the show_id, start_date, status [index]') @@ -41,7 +44,7 @@ class Command(BaseCommand): if not index: raise CommandError('you must provide the show_id, start_date, status index') 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: raise CommandError(ie) |