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

fixed addnote and importnote command after removal of owner to notes.

parent ce745d33
No related branches found
No related tags found
No related merge requests found
...@@ -51,8 +51,7 @@ class Command(BaseCommand): ...@@ -51,8 +51,7 @@ class Command(BaseCommand):
except Exception as e: except Exception as e:
raise CommandError(e) raise CommandError(e)
owner = show.owners.all()[0] if show.owners.count() > 0 else User.objects.get(pk=1) note = Note(timeslot=timeslot, title=title, content=''.join(lines), status=status)
note = Note(timeslot=timeslot, owner=owner, title=title, content=''.join(lines), status=status)
try: try:
note.validate_unique() note.validate_unique()
...@@ -61,4 +60,4 @@ class Command(BaseCommand): ...@@ -61,4 +60,4 @@ class Command(BaseCommand):
else: else:
note.save() note.save()
print 'added note "%s" to "%s"' % (title, timeslot) print 'added note "%s" to "%s"' % (title, timeslot)
\ No newline at end of file
...@@ -11,8 +11,6 @@ USER = 'helsinki' ...@@ -11,8 +11,6 @@ USER = 'helsinki'
PASSWD = 'helsinki' PASSWD = 'helsinki'
DB = 'helsinki' DB = 'helsinki'
OWNER = User.objects.get(pk=1)
class Command(NoArgsCommand): class Command(NoArgsCommand):
help = 'Import notes from current program' help = 'Import notes from current program'
...@@ -47,7 +45,7 @@ WHERE n.sendung_id in (SELECT id FROM sendungen WHERE letzter_termin > current_d ...@@ -47,7 +45,7 @@ WHERE n.sendung_id in (SELECT id FROM sendungen WHERE letzter_termin > current_d
except MultipleObjectsReturned: except MultipleObjectsReturned:
print 'multiple timeslots found for sendung "%s" and datum "%s"' % (stitel, datum) print 'multiple timeslots found for sendung "%s" and datum "%s"' % (stitel, datum)
else: else:
note = Note(timeslot=timeslot, owner=OWNER, title=ntitel, content=notiz) note = Note(timeslot=timeslot, title=ntitel, content=notiz)
try: try:
note.validate_unique() note.validate_unique()
except ValidationError: except ValidationError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment