Closed oscarmlage closed 6 years ago
Sound good, I did something similar in other project for django admin view, maybe this could help https://github.com/luisza/django-cruds-adminlte/blob/filter/cruds_adminlte/filter.py mode of use:
# do a form ticketForm
class ticketFilter(FormFilter):
template = "filter_template.html"
title = "ticket filter title"
form = ticketForm
form_instance = None
remove_params = ['filtro', 'field_text', 'otherautocompletefield_text']
map_parameters = {'cicle': 'acrrosmodelworks__ciclo',
'othermapfield': 'other model field'}
I have no time this week to implement it, but as summary with this you can put whatever form you want to filter, also forms than has autocomplete (django-ajaxselect).
One think more it's also important include a preserver filter feature so search and filter could work in the same view.
Other thing. Django admin filter thieft a lot of space show filter, maybe we can put some vertical colapse to show or hide filter
PR #40 help to solve this :), maybe a look revision needed.
I'm off for vacations these days but definitely I'm looking forward to have time to review the PR. Thanks for the work @luisza
This issue was reviewed ? If not maybe the filter functionality solve this issue and could be close
4538715 Adds the filters as feature. Thanks @luisza for the effort.
Django Admin has filters for the listings, something like:
is converted in something like:
I've not thought about how it could be done in a simple way, maybe something similar to widgets:
('date', DateFilter)
,('customer', RelatedFilter)
('status', BoolFilter)
...date <= request.input
,customer.pk=request.input
,status = True/False
...Brainstorming mode is open :)