Skip to content
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

Fix Schema warnings #803

Merged
merged 8 commits into from
Oct 24, 2017
Merged

Conversation

rpkilby
Copy link
Collaborator

@rpkilby rpkilby commented Oct 24, 2017

The original purpose of this PR was to fix #802, however it was necessary to make a few other changes.

Changes:

  • DjangoFilterBackend.get_schema_fields() no longer catches FilterSet class creation errors (ref Automatic __isnull filter field does not work in django-rest-framework usage  #743)
  • DjangoFilterBackend.get_filter_class() only performs the model check when applicable. The queryset may not have been provided, or the filter_class may not have set Meta.model.
  • Filter.label has been fixed to reference self.model instead of self.parent._meta.model

@rpkilby rpkilby force-pushed the schema-warnings branch 2 times, most recently from 8752ac7 to c7e9ecd Compare October 24, 2017 04:50
@codecov-io
Copy link

codecov-io commented Oct 24, 2017

Codecov Report

Merging #803 into develop will increase coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop    #803      +/-   ##
==========================================
+ Coverage    97.71%   97.8%   +0.08%     
==========================================
  Files           15      15              
  Lines         1138    1138              
==========================================
+ Hits          1112    1113       +1     
+ Misses          26      25       -1
Impacted Files Coverage Δ
django_filters/filterset.py 100% <100%> (ø) ⬆️
django_filters/rest_framework/backends.py 94.44% <100%> (+1.85%) ⬆️
django_filters/filters.py 98.42% <100%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b3e8690...d4fa8c9. Read the comment docs.

@carltongibson carltongibson added this to the Version 2.0 milestone Oct 24, 2017
Copy link
Owner

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Great.

@carltongibson carltongibson merged commit 02a128f into carltongibson:develop Oct 24, 2017
@rpkilby rpkilby deleted the schema-warnings branch October 24, 2017 08:22
carltongibson pushed a commit that referenced this pull request Oct 24, 2017
* Move 'invalid lookup' test to class creation tests

* Fix model reference for Filter.label

* FilterSet should not require Meta class

* Refactor drf backend test views

* Add test for Backend.get_filter_class

* Fix Backend.get_filter_class

* Add Backend.get_schema_fields test for bad fields

* Don't suppress TypeErrors in get_schema_fields
carltongibson pushed a commit that referenced this pull request Oct 24, 2017
* Move 'invalid lookup' test to class creation tests

* Fix model reference for Filter.label

* FilterSet should not require Meta class

* Refactor drf backend test views

* Add test for Backend.get_filter_class

* Fix Backend.get_filter_class

* Add Backend.get_schema_fields test for bad fields

* Don't suppress TypeErrors in get_schema_fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants