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

Missing import django_filters in docs code snippet #772

Closed
kjschiroo opened this issue Sep 4, 2017 · 2 comments
Closed

Missing import django_filters in docs code snippet #772

kjschiroo opened this issue Sep 4, 2017 · 2 comments

Comments

@kjschiroo
Copy link
Contributor

In Adding a FilterSet with filter class the code snippet appears to be missing an import django_filters

@carltongibson
Copy link
Owner

Hi.

I think you made the PR against your own repo. Oops.

More though, I don’t think the import is missing. It’s the line below the one you added.

@kjschiroo
Copy link
Contributor Author

Yep, I screwed up the PR. I see it now, you aren't necessarily missing an import statement, but something does need to change. Exploring in the shell:

In [1]: from django_filters import rest_framework as filters

In [2]: min_price = django_filters.NumberFilter(name="price", lookup_expr='gte')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-d44ca3e674ce> in <module>()
----> 1 min_price = django_filters.NumberFilter(name="price", lookup_expr='gte')

NameError: name 'django_filters' is not defined

In [3]: min_price = filters.NumberFilter(name="price", lookup_expr='gte')

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

No branches or pull requests

2 participants