Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
JoinTheCity
Project
Project
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
Rafal
JoinTheCity
Commits
5bf4e345
Commit
5bf4e345
authored
Jan 01, 2016
by
Rafal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add auto token creator
parent
8c0b7da0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
settings.py
JoinTheCityREST/JoinTheCityREST/settings.py
+2
-0
models.py
JoinTheCityREST/app/User/models.py
+10
-1
No files found.
JoinTheCityREST/JoinTheCityREST/settings.py
View file @
5bf4e345
...
@@ -10,6 +10,8 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
...
@@ -10,6 +10,8 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import
os
import
os
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
...
...
JoinTheCityREST/app/User/models.py
View file @
5bf4e345
...
@@ -2,6 +2,10 @@ from django.contrib.auth.models import User
...
@@ -2,6 +2,10 @@ from django.contrib.auth.models import User
from
django.db
import
models
from
django.db
import
models
# Create your models here.
# Create your models here.
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
rest_framework.authtoken.models
import
Token
from
JoinTheCityREST
import
settings
from
app.API.models
import
API
from
app.API.models
import
API
from
app.Event.models
import
Event
from
app.Event.models
import
Event
...
@@ -35,4 +39,9 @@ class UserEventRequest(models.Model):
...
@@ -35,4 +39,9 @@ class UserEventRequest(models.Model):
def
accept
(
self
):
def
accept
(
self
):
user_event
=
UserEvent
(
user
=
self
.
user
,
event
=
self
.
event
)
user_event
=
UserEvent
(
user
=
self
.
user
,
event
=
self
.
event
)
user_event
.
save
()
user_event
.
save
()
self
.
delete
()
self
.
delete
()
\ No newline at end of file
@
receiver
(
post_save
,
sender
=
User
)
def
create_auth_token
(
sender
,
instance
=
None
,
created
=
False
,
**
kwargs
):
if
created
:
Token
.
objects
.
create
(
user
=
instance
)
\ No newline at end of file
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