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

Suggestion: Import module for use in url include #114

Open
daveschaefer opened this issue Mar 16, 2020 · 0 comments
Open

Suggestion: Import module for use in url include #114

daveschaefer opened this issue Mar 16, 2020 · 0 comments

Comments

@daveschaefer
Copy link

Hello! Thanks for creating this module. It is quite useful.

In the README instructions, it says

Add url(r'^advanced_filters/', include('advanced_filters.urls')) to your project's urlconf.

What do you think about importing the module and referencing it instead?

Using 'advanced_filters.urls' simply as a string makes it harder for people and linters to detect that the project is being used.
If you are e.g. cleaning up your requirements.txt, this usage might get missed, since it only exists inside the string. And the name 'advanced_filters' inside the string does not match the module name 'django-advanced-filters'.

Instead, what do you think about using this module via an import?

 # in urls.py
 from advanced_filters import urls as advanced_filters_urls

 # ...
 urlpatterns = [
 # ...
     url(r"^advanced_filters/", include(advanced_filters_urls)),
 # ...
 ]

This way, linters can better detect that any codebase is using the module. And it is more obvious where and how we use it.
This would make it harder to miss.

I could send a patch to update the README.md if that's helpful.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants