customizing django oscar api in combination with using oscarapi.middleware.ApiBasketMiddleWare

82 views
Skip to first unread message

mat...@naturitas.es

unread,
Apr 4, 2017, 5:08:06 AM4/4/17
to django-oscar
Hello!
I was following the documentation on the django oscar api about use cases and how to customize the django oscar api.
As suggested in the documentation I am using the ApiBasketMiddleWare in my project in order to be able to mix api calls with regular oscar views.

MIDDLEWARE_CLASSES = [
   'oscarapi.middleware.ApiBasketMiddleWare'
]

Then I followed the steps to customize the django oscar api:
Point 4 of the api customizing documentation states:
Include your own app in INSTALLED_APPS instead of django-oscar-api (and add django-oscar-api to your app’s dependencies) and see if this works.

INSTALLED_APPS = [
.
.
'
mycustomapi'
]


If If I define my INSTALLED_APPS like this I get a configuration error since the ApiBasketMiddleware uses the oscarapi models internally.
Howewer If I include both apps in my INSTALLED_APPS configuration like this everything works fine and I can even customize my serializers as described in the documenation.


INSTALLED_APPS = [
.
.
'oscarapi',
'
mycustomapi'
]


My question is is this this solution ok for this use case, or should I rather totally fork the oscarapi app and rewrite all references to oscarapi.models to mycustomapi.models in order to use the ApiBasketMiddleware with a customized version of oscarapi?

A thank you to everyone in advance for developing and supporting oscar!
Regards,
Matyas
Reply all
Reply to author
Forward
0 new messages