How to create categories by custom lookup_field?(django-oscar-api)

27 views Asked by At

project/mycustomapi/views/admin/product.py

from rest_framework.generics import CreateAPIView
from oscarapi.views.admin.product import CategoryAdminDetail

class MyCategoryAdminDetail(CategoryAdminDetail, CreateAPIView):
    lookup_field = 'uid'

urls.py

path("category/<uuid:uid>/",MyCategoryAdminDetail.as_view(),name="my_category_admin_detail"),
path("category/", CategoryAdminList.as_view(), name="my_admin_category_list"),

All requests work correctly, except for post, it always creates a new category at the root, no matter what uid I'm referring to.

0

There are 0 answers