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
6a7a15f6
Commit
6a7a15f6
authored
Dec 30, 2015
by
Rafal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Event Serializer, ViewSet, routeURL
parent
4bd4f129
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
urls.py
JoinTheCityREST/JoinTheCityREST/urls.py
+2
-0
serializers.py
JoinTheCityREST/app/Event/serializers.py
+8
-1
views.py
JoinTheCityREST/app/Event/views.py
+12
-2
No files found.
JoinTheCityREST/JoinTheCityREST/urls.py
View file @
6a7a15f6
...
...
@@ -7,10 +7,12 @@ router = routers.DefaultRouter()
from
app.API
import
views
as
api_views
from
app.Discussion
import
views
as
discussion_views
from
app.Event
import
views
as
event_views
router
.
register
(
r'api'
,
api_views
.
APIViewSet
)
router
.
register
(
r'discussion'
,
discussion_views
.
DiscussionViewSet
)
router
.
register
(
r'message'
,
discussion_views
.
MessageViewSet
)
router
.
register
(
r'event'
,
event_views
.
EventViewSet
)
urlpatterns
=
patterns
(
''
,
...
...
JoinTheCityREST/app/Event/serializers.py
View file @
6a7a15f6
__author__
=
'Rafal'
from
rest_framework
import
serializers
from
app.Event.models
import
Event
class
EventSerializer
(
serializers
.
HyperlinkedModelSerializer
):
class
Meta
:
model
=
Event
fields
=
()
\ No newline at end of file
JoinTheCityREST/app/Event/views.py
View file @
6a7a15f6
from
django.shortcuts
import
render
# Create your views here.
from
rest_framework
import
viewsets
,
permissions
from
app.Event.models
import
Event
from
app.Event.serializers
import
EventSerializer
class
EventViewSet
(
viewsets
.
ModelViewSet
):
"""
API for articles
"""
queryset
=
Event
.
objects
.
all
()
serializer_class
=
EventSerializer
permission_classes
=
(
permissions
.
IsAuthenticatedOrReadOnly
,)
\ 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