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
bc03e863
Commit
bc03e863
authored
Jan 01, 2016
by
Rafal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add event and userevent models
parent
795c250a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
models.py
JoinTheCityREST/app/Event/models.py
+14
-1
serializers.py
JoinTheCityREST/app/Event/serializers.py
+1
-1
serializers.py
JoinTheCityREST/app/User/serializers.py
+1
-1
No files found.
JoinTheCityREST/app/Event/models.py
View file @
bc03e863
from
django.contrib.auth.models
import
User
from
django.db
import
models
# Create your models here.
from
app.Localization.models
import
Localization
from
app.Tag.models
import
Tag
class
Event
(
models
.
Model
):
pass
name
=
models
.
CharField
(
max_length
=
100
)
private
=
models
.
BooleanField
(
default
=
False
)
tag
=
models
.
ManyToManyField
(
Tag
,
related_name
=
'event_tag'
,
blank
=
False
,
null
=
False
,
default
=
None
)
localization
=
models
.
ForeignKey
(
Localization
,
related_name
=
'event_tag'
,
blank
=
False
,
null
=
False
,
default
=
None
)
user
=
models
.
ForeignKey
(
User
,
related_name
=
'event_author'
,
blank
=
False
,
null
=
False
,
default
=
None
)
def
__str__
(
self
):
return
self
.
name
JoinTheCityREST/app/Event/serializers.py
View file @
bc03e863
...
...
@@ -5,4 +5,4 @@ from app.Event.models import Event
class
EventSerializer
(
serializers
.
HyperlinkedModelSerializer
):
class
Meta
:
model
=
Event
fields
=
()
\ No newline at end of file
fields
=
(
'url'
,
'name'
,
'private'
,
'localization'
,
'tag'
,
'user'
)
\ No newline at end of file
JoinTheCityREST/app/User/serializers.py
View file @
bc03e863
...
...
@@ -32,4 +32,4 @@ class UserAPISerializer(serializers.HyperlinkedModelSerializer):
class
UserEventSerializer
(
serializers
.
HyperlinkedModelSerializer
):
class
Meta
:
model
=
UserEvent
fields
=
()
\ No newline at end of file
fields
=
(
'url'
,
'user'
,
'event'
)
\ 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