From 809f3d51e7019cbdea359959175d868d2f67b411 Mon Sep 17 00:00:00 2001 From: Jeremy Bowman <jbowman@edx.org> Date: Fri, 29 Jun 2018 14:23:09 -0400 Subject: [PATCH] TE-2629 Use better field type for applicationaccess.application --- .../migrations/0005_applicationaccess_type.py | 22 +++++++++++++++++++ .../core/djangoapps/oauth_dispatch/models.py | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py diff --git a/openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py b/openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py new file mode 100644 index 00000000000..5692f63b5a9 --- /dev/null +++ b/openedx/core/djangoapps/oauth_dispatch/migrations/0005_applicationaccess_type.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.13 on 2018-06-29 18:18 +from __future__ import unicode_literals + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('oauth_dispatch', '0004_auto_20180626_1349'), + ] + + operations = [ + migrations.AlterField( + model_name='applicationaccess', + name='application', + field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='access', to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL), + ), + ] diff --git a/openedx/core/djangoapps/oauth_dispatch/models.py b/openedx/core/djangoapps/oauth_dispatch/models.py index 97e090cbcc9..9ffff624627 100644 --- a/openedx/core/djangoapps/oauth_dispatch/models.py +++ b/openedx/core/djangoapps/oauth_dispatch/models.py @@ -58,7 +58,7 @@ class ApplicationAccess(models.Model): Specifies access control information for the associated Application. """ - application = models.ForeignKey(oauth2_settings.APPLICATION_MODEL, unique=True, related_name='access') + application = models.OneToOneField(oauth2_settings.APPLICATION_MODEL, related_name='access') scopes = ListCharField( base_field=models.CharField(max_length=32), size=25, -- GitLab