You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am generating DjangoObjectType from my models dynamically. Some of those models have custom model fields that I have defined in my project. This throws an error i.e.:
Describe the solution you'd like
I would like to be able to extend global filterset overrides for those custom fields just like graphene-django does with GRAPHENE_FILTER_SET_OVERRIDES. Doing this by manually extending GrapheneFilterSetMixin.FILTER_DEFAULTS seems to work for my case.
I think this solution does not cause any backward incompatibility nor introduce any complexity. The solution is pretty easy to understand and introduce to the project code base. I hope this will add more flexibility to the project for future users facing similar problems.
classGrapheneFilterSetMixin(BaseFilterSet):
""" A django_filters.filterset.BaseFilterSet with default filter overrides to handle global IDs """FILTER_DEFAULTS=dict(
itertools.chain(
FILTER_FOR_DBFIELD_DEFAULTS.items(),
GRAPHENE_FILTER_SET_OVERRIDES.items(),
getattr(settings, 'EXTRA_FILTER_SET_OVERRIDES', {}).items()
)
)
Describe alternatives you've considered
An alternative I have used before developing above solution was to quickly monkey patch solution, however this did not seem to work not to mention is not a long-time solution.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I am generating
DjangoObjectType
from my models dynamically. Some of those models have custom model fields that I have defined in my project. This throws an error i.e.:Describe the solution you'd like
I would like to be able to extend global filterset overrides for those custom fields just like graphene-django does with
GRAPHENE_FILTER_SET_OVERRIDES
. Doing this by manually extendingGrapheneFilterSetMixin.FILTER_DEFAULTS
seems to work for my case.I think this solution does not cause any backward incompatibility nor introduce any complexity. The solution is pretty easy to understand and introduce to the project code base. I hope this will add more flexibility to the project for future users facing similar problems.
Describe alternatives you've considered
An alternative I have used before developing above solution was to quickly monkey patch solution, however this did not seem to work not to mention is not a long-time solution.
The text was updated successfully, but these errors were encountered: