diff --git a/scheduling/management/commands/loadslots.py b/scheduling/management/commands/loadslots.py index c68663a..5aafca2 100644 --- a/scheduling/management/commands/loadslots.py +++ b/scheduling/management/commands/loadslots.py @@ -44,9 +44,9 @@ class Command(BaseCommand): r = Room(code=roomcode, name=roomdesc) r.save() - for topicname, desc in data['topics'].iteritems(): + for desc in data['allocations']: started = False - t = Topic.objects.get(name=topicname) + t = Topic.objects.get(name=desc['topic']) room = Room.objects.get(code=desc['room']) for (d, h) in slot_generator(data): if (d == desc['start_day'] and h == desc['first_slot']): diff --git a/slots.json.sample b/slots.json.sample index d69327c..cbaf504 100644 --- a/slots.json.sample +++ b/slots.json.sample @@ -21,10 +21,12 @@ ] } ], - "topics": { - "Swift": { + "allocations": [ + { + "topic": "Swift", "room": "A", "start_day": "2012-09-20", "first_slot": "09:30", - "end_day": "2012-09-21", "last_slot": "10:00" } - } + "end_day": "2012-09-21", "last_slot": "10:00" + } + ] }