From 1039555113181ee4b5f10e3cb8dc2aa4cd450605 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 25 Nov 2018 20:38:37 +0100 Subject: [PATCH] core: change provider to one-to-one field --- .../migrations/0002_auto_20181125_1638.py | 19 +++++++++++++++++++ passbook/core/models.py | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 passbook/core/migrations/0002_auto_20181125_1638.py diff --git a/passbook/core/migrations/0002_auto_20181125_1638.py b/passbook/core/migrations/0002_auto_20181125_1638.py new file mode 100644 index 000000000..1fabd2610 --- /dev/null +++ b/passbook/core/migrations/0002_auto_20181125_1638.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.3 on 2018-11-25 16:38 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_core', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='application', + name='provider', + field=models.OneToOneField(default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='passbook_core.Provider'), + ), + ] diff --git a/passbook/core/models.py b/passbook/core/models.py index a5ea7697b..8a90a2236 100644 --- a/passbook/core/models.py +++ b/passbook/core/models.py @@ -49,7 +49,8 @@ class Application(RuleModel): name = models.TextField() launch_url = models.URLField(null=True, blank=True) icon_url = models.TextField(null=True, blank=True) - provider = models.ForeignKey('Provider', null=True, default=None, on_delete=models.SET_DEFAULT) + provider = models.OneToOneField('Provider', null=True, + default=None, on_delete=models.SET_DEFAULT) skip_authorization = models.BooleanField(default=False) objects = InheritanceManager()