Re: Django rest framework viewset and its url

17 views
Skip to first unread message

Dylan Reinhold

unread,
Jan 4, 2018, 11:56:44 PM1/4/18
to django...@googlegroups.com
That link is not valid, and without seeing your views no one will be able to help.

Dylan

On Thu, Jan 4, 2018 at 7:18 PM, <chern...@gmail.com> wrote:
For a better and more detailed question i ask, refer to here : https://stackoverflow.com/questions/48106733/django-rest-framework-viewset-and-url-mixup

In my project, i have 2 model. family and schedule

As i wanted to have 1 api to get all while the other is to get current user only therefore i create 2 viewset for each serializer.
I also specify different url based on the different viewset i created.

eg: router = routers.DefaultRouter()
router.register(r'Family', views.FamilyViewSet)
router.register(r'Schedule2', views.ScheduleViewSet2)
router.register(r'CFamily', views.FamilyViewSet2)
router.register(r'Schedule', views.ScheduleViewSet)
However, only the schedule works properly while family uses FamilyViewSet2 for both in the API. 
I'm confuse about this problem, please help

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9388e16f-fae4-48e2-b860-1b1cb5d0b502%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

chern...@gmail.com

unread,
Jan 5, 2018, 2:25:48 AM1/5/18
to Django users
Ah, i decide to instead of using 2 viewset for a single model, i use 1 viewset and 1 APIView for it.
 
Therefore i deleted both post in here and in stackoverflow. Sorry for the trouble. 





On Friday, January 5, 2018 at 1:56:44 PM UTC+9, Dylan Reinhold wrote:
That link is not valid, and without seeing your views no one will be able to help.

Dylan
On Thu, Jan 4, 2018 at 7:18 PM, <chern...@gmail.com> wrote:
For a better and more detailed question i ask, refer to here : https://stackoverflow.com/questions/48106733/django-rest-framework-viewset-and-url-mixup

In my project, i have 2 model. family and schedule

As i wanted to have 1 api to get all while the other is to get current user only therefore i create 2 viewset for each serializer.
I also specify different url based on the different viewset i created.

eg: router = routers.DefaultRouter()
router.register(r'Family', views.FamilyViewSet)
router.register(r'Schedule2', views.ScheduleViewSet2)
router.register(r'CFamily', views.FamilyViewSet2)
router.register(r'Schedule', views.ScheduleViewSet)
However, only the schedule works properly while family uses FamilyViewSet2 for both in the API. 
I'm confuse about this problem, please help

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages