diff --git a/proposals/migrations/0001_initial.py b/proposals/migrations/0001_initial.py index facebe5..927a56a 100644 --- a/proposals/migrations/0001_initial.py +++ b/proposals/migrations/0001_initial.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-06-12 15:10 +# Generated by Django 1.9.7 on 2016-06-12 16:42 from __future__ import unicode_literals import autoslug.fields +from django.conf import settings import django.contrib.sites.managers from django.db import migrations, models import django.db.models.deletion @@ -15,7 +16,7 @@ class Migration(migrations.Migration): dependencies = [ ('sites', '0002_alter_domain_unique'), - ('accounts', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -23,8 +24,8 @@ class Migration(migrations.Migration): name='Speach', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('order', models.IntegerField(choices=[(1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5'), (6, '6'), (7, '7')])), - ('speaker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounts.Speaker')), + ('order', models.IntegerField(choices=[(1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5'), (6, '6'), (7, '7')], default=1)), + ('speaker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], options={ 'ordering': ['talk', 'order'], @@ -38,7 +39,7 @@ class Migration(migrations.Migration): ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='title', unique=True)), ('description', models.TextField(blank=True, verbose_name='Description')), ('site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sites.Site')), - ('speakers', models.ManyToManyField(through='proposals.Speach', to='accounts.Speaker')), + ('speakers', models.ManyToManyField(through='proposals.Speach', to=settings.AUTH_USER_MODEL)), ], managers=[ ('objects', django.db.models.manager.Manager()), @@ -51,11 +52,6 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=128, unique=True, verbose_name='Name')), ('slug', autoslug.fields.AutoSlugField(editable=False, populate_from='name', unique=True)), - ('site', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sites.Site')), - ], - managers=[ - ('objects', django.db.models.manager.Manager()), - ('on_site', django.contrib.sites.managers.CurrentSiteManager()), ], ), migrations.AddField( @@ -70,6 +66,6 @@ class Migration(migrations.Migration): ), migrations.AlterUniqueTogether( name='speach', - unique_together=set([('speaker', 'talk'), ('order', 'talk')]), + unique_together=set([('order', 'talk'), ('speaker', 'talk')]), ), ] diff --git a/proposals/models.py b/proposals/models.py index 9dbccf7..cab911b 100644 --- a/proposals/models.py +++ b/proposals/models.py @@ -1,3 +1,4 @@ +from django.contrib.auth.models import User from django.contrib.sites.managers import CurrentSiteManager from django.contrib.sites.models import Site from django.core.urlresolvers import reverse @@ -5,8 +6,6 @@ from django.db import models from autoslug import AutoSlugField -from accounts.models import Speaker - __all__ = ['Topic', 'Talk', 'Speach'] @@ -26,7 +25,7 @@ class Talk(models.Model): site = models.ForeignKey(Site, on_delete=models.CASCADE) - speakers = models.ManyToManyField(Speaker, through='Speach') + speakers = models.ManyToManyField(User, through='Speach') title = models.CharField(max_length=128, verbose_name='Title') slug = AutoSlugField(populate_from='title', unique=True) description = models.TextField(blank=True, verbose_name='Description') @@ -46,7 +45,7 @@ class Speach(models.Model): SPEAKER_NO = tuple((i, str(i)) for i in range(1, 8)) - speaker = models.ForeignKey(Speaker, on_delete=models.CASCADE) + speaker = models.ForeignKey(User, on_delete=models.CASCADE) talk = models.ForeignKey(Talk, on_delete=models.CASCADE) order = models.IntegerField(choices=SPEAKER_NO, default=1) @@ -64,4 +63,4 @@ class Speach(models.Model): return self.talk.get_absolute_url() def username(self): - return self.speaker.user.username + return self.speaker.username diff --git a/proposals/templates/accounts/speaker_list.html b/proposals/templates/auth/user_list.html similarity index 100% rename from proposals/templates/accounts/speaker_list.html rename to proposals/templates/auth/user_list.html diff --git a/proposals/templates/proposals/talk_detail.html b/proposals/templates/proposals/talk_detail.html index c42e2a4..4d3840c 100644 --- a/proposals/templates/proposals/talk_detail.html +++ b/proposals/templates/proposals/talk_detail.html @@ -16,7 +16,7 @@