Skip to content

Commit

Permalink
Only route actual retrievals, not the full list of events/series #214
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaith committed Jan 16, 2015
1 parent 96a7e93 commit 9719269
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion talks/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
from django.conf.urls import patterns, include, url

from rest_framework import routers
from rest_framework.routers import Route

from .views import (api_event_search, EventViewSet, EventGroupViewSet, suggest_user, api_create_person,
save_item, remove_item, get_event_group, suggest_person)

router = routers.DefaultRouter()
class TalksAPIRouter(routers.DefaultRouter):
"""
Custom router which is read only, and only provides the retrieve endpoint, not the lists or
"""
routes = [
Route(
url=r'{prefix}/{lookup}$',
mapping={'get': 'retrieve'},
name='{basename}-detail',
initkwargs={'suffix': 'Detail'}
),
]

router = TalksAPIRouter()
router.register(r'events', EventViewSet)
router.register(r'series', EventGroupViewSet)

Expand Down

0 comments on commit 9719269

Please sign in to comment.