@ Hello Nicolas.M,
Hi Forert Admin,
Context
- Project name: Saleor-django
- Team name: …
- Environment name: …
- Agent (forest package) name & version: …
- Database type: i use app Django
- Recent changes made on your end if any: …
Hello, I want to Create my first Smart Collections using Django:
I am using the same code and the same steps as in the documentation here. ( smart-collections Django)
But I am facing this problem:
return data:
{“data”: [{“type”: “customer stat”, “attributes”: {“total_amount”: 690.0, “orders_count”: 4.0, “email”: “med@gmail.fr”}, “id”: 1, “links”: {“self”: “/forest/CustomerStat/1”}}]}
Hey @Mohamed_Ezzaalyouy
Could you also share a screenshot of the Network console tab, on the failing call, with both the request and the response?
Thanks in advance
Hi @Mohamed_Ezzaalyouy,
Assuming you strictly follow the documentation, your problem is about a trailing ‘s’ :
In app/forest/customer_stats.py
it is written :
self.name = 'CustomerStat' # (note that is in singular form),
and in the app.urls.py
of the documentation, it is written :
path(‘/CustomerStats’, csrf_exempt(views.CustomerStatsView.as_view()), name=‘customer-stats’),
The url path must match the smart collection name.
We will fix this typo in the documentation, thanks for the error reporting.
Let us know if that solve your problem.
Have a nice day.
3 Likes
Hi @julien.barreau
The problem has been resolved.
thanks you for your support
Hello! I am having a similar issue. The response to the failed request for me is:
{“errors”: [{“detail”: “list index out of range”}]}
- Project name: Aldous
- Team name: Operations
- Environment name: Production
- Agent (forest package) name & version: django-forestadmin==1.5.0
- Database type: Postgres
- Recent changes made on your end if any: Changes to RestApi views. Nothing to do with DB, and my API is working fine.
Hello @0xdesdenova,
Please do not bump older solved posts.
If you have a similar issue but the proposed solution does not answer your question, it means that it is probably a different root cause.
Please open up a new post (following the template as you did), and with your specific error details. A stack trace would be nice.
Thanks !
1 Like