Closed smirolo closed 5 years ago
What about aliased that hide the relation fields? Like ('slug', 'user__username')
. That would require to either change the Vue code to pass the updated arguments or building an alias solution. Btw there is a popular library that we might leverage here. It implements aliasing and a bunch of other things -- https://django-filter.readthedocs.io/en/master/ref/filters.html#orderingfilter.
Yes. use django-filter
for aliases if those are included.
PR #200 fails on Django>=2.1
File "TOXENV/py36-django2.1/djaodjin-saas/reps/djaodjin-saas/saas/filters.py", line 156, in get_valid_fields
rel = queryset.model._meta.get_field(relation).rel
AttributeError: 'ForeignKey' object has no attribute 'rel'
We need to use remote_field
instead of rel
For Django 2.0+
OK. Add a get_related_field
method in compat.py
that handles both Django1.11 and Django2.0+. Thank you.
tested. tests pass on both Django1.11 and Django2.2
This requires to replaces extra_views by filters (see saas/api/accounts.py for example).
The only thing to do (I believe) is to replace
sort_fields_aliases
byordering_fields
, addSearchFilter
andOrderFilter
infilter_backends
and remove the extra_mixins from the inherited classes.