Commit 50ef4696 authored by Sharad Heft's avatar Sharad Heft
Browse files

Create models to store auxiliary information.

parent 6be5ff7b
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Character',
fields=[
('id', models.BigIntegerField(serialize=False, primary_key=True)),
('name', models.CharField(max_length=128)),
('alliance_id', models.BigIntegerField()),
('corporation_id', models.BigIntegerField()),
],
options={
},
bases=(models.Model,),
),
migrations.CreateModel(
name='TESTOAuth2Data',
fields=[
('user', models.OneToOneField(related_name='auth', primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('access_token', models.CharField(max_length=128)),
('refresh_token', models.CharField(max_length=128)),
('primary_character', models.ForeignKey(default=None, to='test_oauth.Character', null=True)),
],
options={
},
bases=(models.Model,),
),
migrations.AddField(
model_name='character',
name='auth',
field=models.ForeignKey(related_name='characters', to=settings.AUTH_USER_MODEL),
preserve_default=True,
),
]
from django.conf import settings
from django.db import models
class Character(models.Model):
id = models.BigIntegerField(primary_key=True)
name = models.CharField(max_length=128)
auth = models.ForeignKey(
settings.AUTH_USER_MODEL,
db_index=True,
related_name='characters'
)
alliance_id = models.BigIntegerField(null=False)
corporation_id = models.BigIntegerField(null=False)
class TESTOAuth2Data(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
primary_key=True,
related_name='auth'
)
access_token = models.CharField(max_length=128)
refresh_token = models.CharField(max_length=128)
primary_character = models.ForeignKey(Character, null=True, default=None)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment