I have create update api in django,but i am not getting its api link in postman urls.py from rest_framework.routers import DefaultRouter from doctor import views from .views import* router=DefaultRouter() router.register(r'Patient', views.PatViewSet, basename='PatViewSet') router.register(r'Sch', views.TotalViewSet, basename='TotalViewSet') router.register(r'Doctor', views.DocViewSet, basename='DocViewSet')
urlpatterns = router.urls views.py class TotalViewSet(viewsets.ViewSet): def update(self,request,pk=None): try: data=request.data doctor=Doctor.objects.get(pk=pk) print(doctor) timings=data.get('schedule') DAYS=Schedule.DAYS for day in DAYS: sch=Schedule() sch.doctor=doctor sch.days=day[0] sch.start_time=timings[day[1]]['start_time'] sch.end_time=timings[day[1]]['end_time'] sch.save() return Response({"success": True}, status=status.HTTP_200_OK) except Exception as error: #traceback.print_exc() return Response({"message": str(error), "success": False}, status=status.HTTP_200_OK) -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/62644d15-e1f4-4beb-ad84-0ecaadf51109n%40googlegroups.com.