Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Partner Dashboard API #268

Open
theArsalanM opened this issue Jun 27, 2021 · 4 comments
Open

Feature Request - Partner Dashboard API #268

theArsalanM opened this issue Jun 27, 2021 · 4 comments

Comments

@theArsalanM
Copy link

Django Oscar allow partners to login to dashboard, and perform operations specific to their store i.e view your orders, add/update your products etc.

Django Oscar API provides admin api, but seems like this API can be used by "staff users" or "superusers" only. This admin API cannot be used for standalone app for partners.

Is this the design principle of Oscar-API that doesn't allow partner APIs, or is this something we can work on as a new feature?

@ibr9him
Copy link

ibr9him commented Jul 7, 2021

This would be nice.... Currently I am working on something similar. I want to query products by partner and expose that functionality through rest api.

what I am trying to achieve is
GET /api/products/?partner=2

My work so far, I am trying to extend ProductList view and add my logic there. However I getting this error

File "/usr/local/lib/python3.7/site-packages/oscar/core/loading.py", line 176, in _pluck_classes
classname, ", ".join(packages)))
oscar.core.exceptions.ClassNotFoundError: No class 'ProducList' found in 

my work lives in APPNAME/forked_apps/api_customization

My code:

from oscarapi.utils.loading import get_api_class

ProducList = get_api_class("oscarapi.views.produst", "ProducList")

class ProductList(ProducList):

    def get_queryset(self):
        """
        Allow filtering on structure so standalone and parent products can
        be selected separately, eg::
            http://127.0.0.1:8000/api/products/?structure=standalone
        or::
            http://127.0.0.1:8000/api/products/?structure=parent
        """
        qs = super(ProductList, self).get_queryset()
        structure = self.request.query_params.get("structure")
        if structure is not None:
            return qs.filter(structure=structure)
        """
        Allow filtering on partner products, eg::
            http://127.0.0.1:8000/api/products/?partner=2
        """
        partner = self.request.query_params.get("partner")
        if partner is not None:
            return qs.filter(partner=partner)

        return qs

I could use some hints.

@maerteijn
Copy link
Member

maerteijn commented Jul 8, 2021

@ibr9him Hint: ProducList

Next to that, I think we need to solve this in a different way, see below.

@maerteijn
Copy link
Member

maerteijn commented Jul 8, 2021

Ok, I gave it some thought as I was actually not aware of the fact that you could link users to a Partner and that they can login into the oscar dashboard to view their products and orders.

I think that we can handle this by exposing the admin api for users attached to a specific partner. I will think about this and discuss this idea the following weeks.

@ibr9him
Copy link

ibr9him commented Jul 8, 2021

@maerteijn gotcha.

Will now you mentioned it 'I think that we can handle this by exposing the admin api for users attached to a specific partner.' that was my next step.

Waiting to hear your thought on it and help if I could

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants