Added Track model for schedule headings
This commit is contained in:
parent
7ae022d2c4
commit
765e80765c
3 changed files with 59 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
from django.contrib import admin
|
||||
|
||||
from symposion.schedule.models import Schedule, Day, Room, SlotKind, Slot, SlotRoom, Presentation, Session, SessionRole
|
||||
from symposion.schedule.models import Schedule, Day, Room, SlotKind, Slot, SlotRoom, Presentation, Session, SessionRole, Track
|
||||
|
||||
|
||||
class DayInline(admin.StackedInline):
|
||||
|
@ -55,3 +55,4 @@ admin.site.register(Slot, SlotAdmin)
|
|||
admin.site.register(Session)
|
||||
admin.site.register(SessionRole)
|
||||
admin.site.register(Presentation, PresentationAdmin)
|
||||
admin.site.register(Track)
|
||||
|
|
41
symposion/schedule/migrations/0007_auto_20161224_1709.py
Normal file
41
symposion/schedule/migrations/0007_auto_20161224_1709.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.7 on 2016-12-24 06:09
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('symposion_schedule', '0006_room_track'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Track',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=80, verbose_name='Track')),
|
||||
('day', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='symposion_schedule.Day')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Track',
|
||||
'verbose_name_plural': 'Tracks',
|
||||
},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='room',
|
||||
name='track',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='track',
|
||||
name='room',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='symposion_schedule.Room'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='track',
|
||||
unique_together=set([('room', 'day')]),
|
||||
),
|
||||
]
|
|
@ -51,17 +51,31 @@ class Room(models.Model):
|
|||
|
||||
schedule = models.ForeignKey(Schedule, verbose_name=_("Schedule"))
|
||||
name = models.CharField(max_length=65, verbose_name=_("Name"))
|
||||
track = models.CharField(max_length=80, verbose_name=_("Track"), default=None, blank=True, null=True)
|
||||
order = models.PositiveIntegerField(verbose_name=_("Order"))
|
||||
|
||||
def __str__(self):
|
||||
return '%s (%s)' % (self.name, self.track)
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Room")
|
||||
verbose_name_plural = _("Rooms")
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Track(models.Model):
|
||||
name = models.CharField(max_length=80, verbose_name=_("Track"))
|
||||
room = models.ForeignKey(Room)
|
||||
day = models.ForeignKey(Day)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class Meta:
|
||||
unique_together = [('room', 'day')]
|
||||
verbose_name = _("Track")
|
||||
verbose_name_plural = _("Tracks")
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class SlotKind(models.Model):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue