Hello all, my role in my company is the middle man between engineering and our account managers. I’m trying to get a better understanding on how the URL Filtering works in Django Admin. My main question revolves around date ranges, if I have a table I’m wanting to filter based on one of the entries that falls between two dates I can get this far:
https://testurl.com/admin/genericusers/specialrecords/?first_viewed=2021-06-01 (Not a real address)
First, is that the correct syntax? Second, what would I need to use after “2021-06-01” to make that a range? If someone could point me to URL filtering documentation that lays it out I would be greatful!
Are you talking about the Django admin (implied by the use of the
/admin/ path component in the sample URL)? Or are you talking about a user-written page?
yeah, Django Admin. Sorry!
So if you’re talking about the Django admin list_filter facility, there’s no “built in” way to specify an arbitrary range. However, if you read the docs for it, you can see there is a way to predefine some ranges that will appear on the admin page. It may also be possible to accept url-parameters entered directly that can identify a range, but it would be up to your implementation to parse / interpret them.
Also, I wouldn’t be “me” if I didn’t remind people that:
The admin’s recommended use is limited to an organization’s internal management tool. It’s not intended for building your entire front end around.