The request to your server either failed or returned invalid data 28- 04- 2023

@ 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:

0

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 :wave:

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 :pray:

hi @jeffladiray ,


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