Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
tanbama
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
freetux
tanbama
Commits
13cdff99
Commit
13cdff99
authored
May 05, 2018
by
freetux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some fixes
parent
ce008397
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
12 deletions
+19
-12
tanbamaapp/tanbama/settings.py
tanbamaapp/tanbama/settings.py
+1
-0
tanbamaapp/tanbama/wsgi.py
tanbamaapp/tanbama/wsgi.py
+1
-1
tanbamaapp/users/views.py
tanbamaapp/users/views.py
+9
-4
tanbamaapp/weights/migrations/0001_initial.py
tanbamaapp/weights/migrations/0001_initial.py
+6
-6
tanbamaapp/weights/migrations/__init__.py
tanbamaapp/weights/migrations/__init__.py
+0
-0
tanbamaapp/weights/models.py
tanbamaapp/weights/models.py
+1
-0
tanbamaapp/weights/serializers.py
tanbamaapp/weights/serializers.py
+1
-1
No files found.
tanbamaapp/tanbama/settings.py
View file @
13cdff99
...
...
@@ -27,6 +27,7 @@ DEBUG = True
ALLOWED_HOSTS
=
[]
APPEND_SLASH
=
False
# Application definition
...
...
tanbamaapp/tanbama/wsgi.py
View file @
13cdff99
...
...
@@ -11,6 +11,6 @@ import os
from
django.core.wsgi
import
get_wsgi_application
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"t
odoapp
.settings"
)
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"t
anbama
.settings"
)
application
=
get_wsgi_application
()
tanbamaapp/users/views.py
View file @
13cdff99
...
...
@@ -4,22 +4,27 @@ from rest_framework.generics import CreateAPIView, GenericAPIView
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
from
users.serializers
import
UserRegistrationSerializer
,
UserLoginSerializer
import
jwt
from
rest_framework_jwt.utils
import
jwt_payload_handler
from
tanbama
import
settings
class
UserRegistrationAPIView
(
CreateAPIView
):
authentication_classes
=
()
permission_classes
=
()
serializer_class
=
UserRegistrationSerializer
def
create
(
self
,
request
,
*
args
,
**
kwargs
):
serializer
=
self
.
get_serializer
(
data
=
request
.
data
)
serializer
.
is_valid
(
raise_exception
=
True
)
self
.
perform_create
(
serializer
)
user
=
serializer
.
instance
token
,
created
=
Token
.
objects
.
get_or_create
(
user
=
user
)
payload
=
jwt_payload_handler
(
user
=
user
)
token
=
jwt
.
encode
(
payload
,
settings
.
SECRET_KEY
)
token
=
token
.
decode
(
'unicode_escape'
)
data
=
serializer
.
data
data
[
"token"
]
=
token
.
key
data
[
"token"
]
=
token
headers
=
self
.
get_success_headers
(
serializer
.
data
)
return
Response
(
data
,
status
=
status
.
HTTP_201_CREATED
,
headers
=
headers
)
return
Response
(
data
,
status
=
status
.
HTTP_201_CREATED
,
headers
=
headers
)
\ No newline at end of file
tanbamaapp/weights/migrations/0001_initial.py
View file @
13cdff99
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 201
6-03-15 21:16
# Generated by Django 1.9.4 on 201
8-05-03 16:37
from
__future__
import
unicode_literals
from
django.conf
import
settings
...
...
@@ -19,10 +19,10 @@ class Migration(migrations.Migration):
migrations
.
CreateModel
(
name
=
'Weight'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'text'
,
models
.
CharField
(
max_length
=
255
,
verbose_name
=
'text'
)),
(
'weight'
,
models
.
Integer
Field
()),
(
'height'
,
models
.
IntegerField
(
)),
(
'id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'text'
,
models
.
CharField
(
max_length
=
255
)),
(
'weight'
,
models
.
Float
Field
()),
(
'height'
,
models
.
FloatField
(
null
=
True
)),
(
'date_created'
,
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'Date Created'
)),
(
'user'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
settings
.
AUTH_USER_MODEL
)),
],
...
...
@@ -31,4 +31,4 @@ class Migration(migrations.Migration):
'verbose_name_plural'
:
'Weights'
,
},
),
]
\ No newline at end of file
]
tanbamaapp/weights/migrations/__init__.py
0 → 100644
View file @
13cdff99
tanbamaapp/weights/models.py
View file @
13cdff99
...
...
@@ -7,6 +7,7 @@ from django.utils.translation import ugettext_lazy as _
class
Weight
(
models
.
Model
):
id
=
models
.
AutoField
(
primary_key
=
True
)
user
=
models
.
ForeignKey
(
settings
.
AUTH_USER_MODEL
,
on_delete
=
models
.
CASCADE
)
text
=
models
.
CharField
(
max_length
=
255
)
weight
=
models
.
FloatField
()
...
...
tanbamaapp/weights/serializers.py
View file @
13cdff99
...
...
@@ -16,5 +16,5 @@ class WeightSerializer(serializers.ModelSerializer):
user
=
WeightUserSerializer
(
read_only
=
True
)
class
Meta
:
model
=
Weight
fields
=
(
"user"
,
"text"
,
"weight"
,
"height"
,
"date_created"
)
fields
=
(
"
id"
,
"
user"
,
"text"
,
"weight"
,
"height"
,
"date_created"
)
\ 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