-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Deprecate DjangoFilterBackend #4507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Haven't yet reviewed, but yes agreed on this point. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
model = queryset.model | ||
fields = filter_fields | ||
# get_fields was introduced after the move to django-filter | ||
def get_fields(self, view): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a test on get_fields
would fix the patch coverage failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given my comment here, I'm not really sure how to write a meaningful test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomchristie a small amount of guidance if you please... :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows introspection of filter fields for schema generation. It's possible that we ought to change the signature prior to 3.5, so that it returns more information that simply the names. Currently undecided on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So - just leave it as is for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @tomchristie. The 3.5 release seems imminent - did you want to merge this in for 3.5 or hold of until later? Aside from fixing conflicts, anything else I should clean up?
Milestoning to ensure we review this as part of 3.5. May or may not make it in. Initial thoughts are that the change footprint looks much larger than expected. Also could we get some details on what users need to do in order to replace this with the |
Also for consideration - if it's available as a third party package, then we might prefer to simple remove it as long as the drop-in replacement is easy to make. |
https://django-filter.readthedocs.io/en/latest/rest_framework.html It should Just Work™ — happy to take Issues if it doesn't. |
Can DRF (conditionally) make this the default setting? |
This mostly appears to be because this is removing the old |
If we do decide to do this, I'm not sure why we'd decide to keep the stub class. Does the |
|
Hi there. My take on this would be relatively simple:
Once 3.5 is out, we'll raise this to What I'm not sure about all this is about how compatible the current code is with Django-filters. |
Almost entirely... as per the comment, it should be "change the import and you're good to go". It was a straight migration of the the DRF code and tests. Since added there's a slight change to the filter defaults which make boolean and date handling more API friendly — this was the No1 most requested thing in the world — but that's it. |
@xordoquy - my thoughts on removing the code is to prevent having to maintain the backend in both packages. For example, see #4574 & carltongibson/django-filter#521. Would this deprecation timeline make sense?
|
In my opinion, this side of the code shouldn't be maintain. It's deprecated and would remain just for deprecation policy. The answer to bugfix being use the django filter's solution |
Attempts to resolve #3371. The deprecation assumes/asserts the presence of the migrated django-filter backend, which requires the recent
0.15
release. Because of the dependency version bump, it might be appropriate to save this for DRF3.5
?