These are chat archives for allegro/ralph

6th
Oct 2015
Michał Suszko
@msuszko
Oct 06 2015 09:27
How to set default value with new filters?
Mateusz Kurek
@mkurek
Oct 06 2015 09:28
@msuszko what kind of filter? choice, date, text etc?
Michał Suszko
@msuszko
Oct 06 2015 09:28
I used to have custom ChoiceFilter with default value
using overloaded value method
It seems to be possible to register custom filter before register_custom_filters but there must be a better way ;-)
Mateusz Kurek
@mkurek
Oct 06 2015 09:43
@msuszko it's now raw django approach to admin filters - we're only overwriting default filters classes for some fields types. Your custom filter should work fine now (maybe you should inherit from other class than before). See https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter for details
✪ vi4m Marcin Kliks
@vi4m
Oct 06 2015 09:46
we removed Ralph.* prefix from filters classes, you can subclass as documented above
Michał Suszko
@msuszko
Oct 06 2015 10:23
When you register filter using FieldListFilter.register with take_priority=True I have no way to use subclassed filter in my app
Mateusz Kurek
@mkurek
Oct 06 2015 11:13
yes, but you filter will be specified by class, not by field name, so our registration doesn't matter here
Michał Suszko
@msuszko
Oct 06 2015 13:24
@mkurek I've used list_filter = [('field_name', MyCustomChoicesListFilter)] but had to fix AdminSearchFieldsMixin (#1823)
och
Mateusz Kurek
@mkurek
Oct 06 2015 13:27
Wouldn't list_filter = [MyCustomChoicesListFilter] work?
Michał Suszko
@msuszko
Oct 06 2015 13:30
@mkurek No: (admin.E114) The value of 'list_filter[0]' must not inherit from 'FieldListFilter'.
Mateusz Kurek
@mkurek
Oct 06 2015 14:05
@msuszko you're right. I give :ok: to your PR