Skip to content

Commit

Permalink
fixes on the first migration
Browse files Browse the repository at this point in the history
  • Loading branch information
synasius committed Apr 6, 2015
1 parent 62847af commit 9895b76
Showing 1 changed file with 23 additions and 31 deletions.
54 changes: 23 additions & 31 deletions oauth2_provider/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings

from oauth2_provider.settings import oauth2_settings
import oauth2_provider.generators
from django.db import models, migrations
import oauth2_provider.validators
import oauth2_provider.generators
from django.conf import settings


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
migrations.swappable_dependency(oauth2_settings.APPLICATION_MODEL),
]

operations = [
migrations.CreateModel(
name='AccessToken',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('token', models.CharField(max_length=255, db_index=True)),
('expires', models.DateTimeField()),
('scope', models.TextField(blank=True)),
],
),
migrations.CreateModel(
name='Application',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('client_id', models.CharField(default=oauth2_provider.generators.generate_client_id, unique=True, max_length=100, db_index=True)),
('redirect_uris', models.TextField(validators=[oauth2_provider.validators.validate_uris], help_text='Allowed URIs list, space separated', blank=True)),
('redirect_uris', models.TextField(help_text='Allowed URIs list, space separated', blank=True, validators=[oauth2_provider.validators.validate_uris])),
('client_type', models.CharField(max_length=32, choices=[('confidential', 'Confidential'), ('public', 'Public')])),
('authorization_grant_type', models.CharField(max_length=32, choices=[('authorization-code', 'Authorization code'), ('implicit', 'Implicit'), ('password', 'Resource owner password-based'), ('client-credentials', 'Client credentials')])),
('client_secret', models.CharField(default=oauth2_provider.generators.generate_client_secret, blank=True, max_length=255, db_index=True)),
('name', models.CharField(blank=True, max_length=255)),
('client_secret', models.CharField(default=oauth2_provider.generators.generate_client_secret, max_length=255, db_index=True, blank=True)),
('name', models.CharField(max_length=255, blank=True)),
('skip_authorization', models.BooleanField(default=False)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, related_name='oauth2_provider_application')),
('user', models.ForeignKey(related_name='oauth2_provider_application', to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='AccessToken',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('token', models.CharField(max_length=255, db_index=True)),
('expires', models.DateTimeField()),
('scope', models.TextField(blank=True)),
('application', models.ForeignKey(to=oauth2_settings.APPLICATION_MODEL)),
('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)),
],
),
migrations.CreateModel(
name='Grant',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('code', models.CharField(max_length=255, db_index=True)),
('expires', models.DateTimeField()),
('redirect_uri', models.CharField(max_length=255)),
Expand All @@ -57,21 +59,11 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='RefreshToken',
fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)),
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('token', models.CharField(max_length=255, db_index=True)),
('access_token', models.OneToOneField(to='oauth2_provider.AccessToken', related_name='refresh_token')),
('access_token', models.OneToOneField(related_name='refresh_token', to='oauth2_provider.AccessToken')),
('application', models.ForeignKey(to=oauth2_settings.APPLICATION_MODEL)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='accesstoken',
name='application',
field=models.ForeignKey(to=oauth2_settings.APPLICATION_MODEL),
),
migrations.AddField(
model_name='accesstoken',
name='user',
field=models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True, blank=True),
),
]

0 comments on commit 9895b76

Please sign in to comment.