silentsokolov / django-admin-rangefilter

A Django app that lets you filter data by date range and numeric range in the admin UI
MIT License
713 stars 106 forks source link

Error 500 when filtering by date range and foreign key field #81

Closed LeonardoCuraca closed 2 years ago

LeonardoCuraca commented 2 years ago

I have 2 models in my project, Order and Ticket Tickets are created when an order is paid so they have a one to many relation. On Django admin, I need to filter tickets by order__branch and date range, but it doesn't work.

Is there a way to avoid this?

these are the parameters of the url and the message I get ?orderbranchidexact=5&created_atrangegte=01%2F08%2F2022&created_atrange__lte=10%2F08%2F2022

image

silentsokolov commented 2 years ago

This is hard to debug. Can you put in a debug message or something?

LeonardoCuraca commented 2 years ago

I have no messages in logs but I think its solved. My filter list was like this: order, order__branch and the created_at with the rangefilter So deleting 'order' from the list was the solution. I dont know why but I'll leave it here. Thanks for your response

silentsokolov commented 2 years ago

Close. Reopen if needed.