Skip to content

Commit

Permalink
create day if it does not exist. allow content override.
Browse files Browse the repository at this point in the history
  • Loading branch information
codersquid committed Jun 17, 2014
1 parent d6ecced commit d0127fa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions symposion/schedule/management/commands/create_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
def create_presentation_slots(data):
""" Creates a SlotRoom based on a csv file
Room, SlotKind, Day must exist
Room and SlotKind must exist
If Day does not exist it will be created
"""

for row in data:
Expand All @@ -51,17 +52,19 @@ def create_presentation_slots(data):

room = Room.objects.get(schedule=schedule, name=room_name)
slotkind = SlotKind.objects.get(schedule=schedule, label=kind_label)
day = Day.objects.get(schedule=schedule, date=date)
day, create = Day.objects.get_or_create(schedule=schedule, date=date)

slot = Slot.objects.create(
kind=slotkind,
day=day,
start=start,
end=end,
content_override=description,
)
SlotRoom.objects.create(slot=slot, room=room)

if description != '':
slot.content_override = description

if proposal_id:
assign_presentation(slot, schedule.section, proposal_id)

Expand Down

0 comments on commit d0127fa

Please sign in to comment.