Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
test-it
test_oauth2_django
Commits
50ef4696
Commit
50ef4696
authored
Nov 05, 2017
by
Sharad Heft
Browse files
Create models to store auxiliary information.
parent
6be5ff7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
test_oauth/migrations/0001_initial.py
0 → 100644
View file @
50ef4696
# -*- 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
,
),
]
test_oauth/migrations/__init__.py
0 → 100644
View file @
50ef4696
test_oauth/models.py
0 → 100644
View file @
50ef4696
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment