Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
f0d4232c
Commit
f0d4232c
authored
Nov 17, 2012
by
Jonas Liljestrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Django 1.5 support, and awareness for AUTH_USER_MODEL
parent
346a79b1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
+15
-1
rest_framework/authtoken/models.py
+15
-1
No files found.
rest_framework/authtoken/models.py
View file @
f0d4232c
...
@@ -2,14 +2,28 @@ import uuid
...
@@ -2,14 +2,28 @@ import uuid
import
hmac
import
hmac
from
hashlib
import
sha1
from
hashlib
import
sha1
from
django.db
import
models
from
django.db
import
models
from
django
import
VERSION
try
:
from
django.db.models.auth
import
User
user_model
=
User
except
ImportError
:
raise
ImportError
else
:
raise
if
VERSION
[:
2
]
in
((
1
,
5
,),):
from
django.conf
import
settings
if
hasattr
(
settings
,
AUTH_USER_MODEL
):
user_model
=
settings
.
AUTH_USER_MODEL
class
Token
(
models
.
Model
):
class
Token
(
models
.
Model
):
"""
"""
The default authorization token model.
The default authorization token model.
"""
"""
key
=
models
.
CharField
(
max_length
=
40
,
primary_key
=
True
)
key
=
models
.
CharField
(
max_length
=
40
,
primary_key
=
True
)
user
=
models
.
OneToOneField
(
'auth.User'
,
related_name
=
'auth_token'
)
user
=
models
.
OneToOneField
(
user_model
,
related_name
=
'auth_token'
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
def
save
(
self
,
*
args
,
**
kwargs
):
def
save
(
self
,
*
args
,
**
kwargs
):
...
...
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