From: Jan Szejko Date: Thu, 19 Jan 2017 12:23:02 +0000 (+0100) Subject: onetoonefield in usercard & migrations X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/c4fe572d62089734787623b2b1bc87daa7cdd4dc?ds=inline onetoonefield in usercard & migrations --- diff --git a/apps/catalogue/migrations/0010_auto_20170119_1321.py b/apps/catalogue/migrations/0010_auto_20170119_1321.py new file mode 100644 index 00000000..b6721724 --- /dev/null +++ b/apps/catalogue/migrations/0010_auto_20170119_1321.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0009_auto_20161130_1346'), + ] + + operations = [ + migrations.AlterModelOptions( + name='publishrecord', + options={'ordering': ['-timestamp'], 'verbose_name': 'book publish record', 'verbose_name_plural': 'book publish records'}, + ), + migrations.AlterField( + model_name='document', + name='tags', + field=models.ManyToManyField(to='catalogue.Tag', blank=True), + ), + ] diff --git a/apps/organizations/migrations/0009_auto_20170119_1321.py b/apps/organizations/migrations/0009_auto_20170119_1321.py new file mode 100644 index 00000000..7bef8cb5 --- /dev/null +++ b/apps/organizations/migrations/0009_auto_20170119_1321.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('organizations', '0008_organization_tags'), + ] + + operations = [ + migrations.AlterField( + model_name='organization', + name='tags', + field=models.ManyToManyField(to='catalogue.Tag', blank=True), + ), + migrations.AlterField( + model_name='usercard', + name='user', + field=models.OneToOneField(primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/apps/organizations/models.py b/apps/organizations/models.py index 6b1d918d..c236da42 100644 --- a/apps/organizations/models.py +++ b/apps/organizations/models.py @@ -90,7 +90,7 @@ class Card(models.Model): @python_2_unicode_compatible class UserCard(Card): preview_html_template = 'organizations/snippets/user.html' - user = models.ForeignKey(User, unique=True, primary_key=True) + user = models.OneToOneField(User, primary_key=True) def __str__(self): return str(self.user)