You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @direcyoung, thanks for raising this! ✨
Let me help clarify how paths work in django-ninja-crud:
The basic route structure works like this:
classGroupViewSet(APIViewSet):
model=Groupcreate_group=CreateView(...) # POST /list_groups=ListView(...) # GET /read_group=ReadView(...) # GET /{id}update_group=UpdateView(...) # PUT /{id}delete_group=DeleteView(...) # DELETE /{id}
The /group prefix should be defined when registering the router:
api.add_router("/group", group_router)
If you want to override the create endpoint, you can simply remove it from the viewset and define your custom method with the root path /:
@router.post("/", response={200: GroupOut, 400: Error})defcreate_group(self, request):
# your custom logic here
You can find more details in the CreateView documentation. Let me know if you need any clarification! 🤗
For example, if I want to replace the post method, I need to modify the access path to
group/post/
instead of using thegroup/
The text was updated successfully, but these errors were encountered: