Make parameters order stable for multi-parameter URLs (#106)
Fixes #105 * Added intermittently failing test for #105 * Make parameter order stable for urls with multiple params
This commit is contained in:
committed by
Cristi Vîjdea
parent
6dd8ded05d
commit
322971f3e7
@@ -1,3 +1,4 @@
|
||||
from django.conf.urls import url
|
||||
from rest_framework import routers
|
||||
|
||||
from todo import views
|
||||
@@ -8,3 +9,8 @@ router.register(r'another', views.TodoAnotherViewSet)
|
||||
router.register(r'yetanother', views.TodoYetAnotherViewSet)
|
||||
|
||||
urlpatterns = router.urls
|
||||
|
||||
urlpatterns += [
|
||||
url(r'^(?P<todo_id>\d+)/yetanother/(?P<yetanother_id>\d+)/$',
|
||||
views.NestedTodoView.as_view(),),
|
||||
]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from rest_framework import viewsets
|
||||
from rest_framework.generics import RetrieveAPIView
|
||||
|
||||
from .models import Todo, TodoAnother, TodoYetAnother
|
||||
from .serializer import TodoAnotherSerializer, TodoSerializer, TodoYetAnotherSerializer
|
||||
@@ -20,3 +21,7 @@ class TodoAnotherViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
class TodoYetAnotherViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
queryset = TodoYetAnother.objects.all()
|
||||
serializer_class = TodoYetAnotherSerializer
|
||||
|
||||
|
||||
class NestedTodoView(RetrieveAPIView):
|
||||
serializer_class = TodoYetAnotherSerializer
|
||||
|
||||
Reference in New Issue
Block a user