Make (user, client) unique on UserConsent

We assume this combination is unique with our get and get_or_create
calls.
This commit is contained in:
Sjoerd Langkemper 2015-11-10 11:29:05 +01:00
parent 12e2dddb2a
commit 2fc4c138b3
2 changed files with 20 additions and 2 deletions

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('oidc_provider', '0005_token_refresh_token'),
]
operations = [
migrations.AlterUniqueTogether(
name='userconsent',
unique_together=set([('user', 'client')]),
),
]

View file

@ -89,5 +89,5 @@ class Token(BaseCodeTokenModel):
class UserConsent(BaseCodeTokenModel):
pass
class Meta:
unique_together = ('user', 'client')