modlinltd/django-advanced-filters

'advanced_filters_advancedfilter_change' is not a valid view function or pattern name.

Closed this issue · 6 comments

Hi,

Here's the error I get when trying to click on one of the created advanced filters in the admin.

Reverse for 'advanced_filters_advancedfilter_change' not found. 'advanced_filters_advancedfilter_change' is not a valid view function or pattern name.

django version: 1.11.3
python version: 3.4.5
django-advanced-filters==1.0.7.1

In advanced_filters/templates/admin/advanced_filters.html there's a reverse url lookup for admin:advanced_filters_advancedfilter_change, but django can't seem to find that url name.

The url name doesn't seem to be defined anywhere in the project. E.g., grep -r advanced_filters_advancedfilter_change * only occurs in `advanced_filters/templates/admin/advanced_filters.html. Nowhere else. Where is that url name set? I'm really confused and I feel like I'm missing something really simple.

Thanks

@filipkilibarda Did you find a workaround for this issue?
Because I am just experiencing the exactly same error.

Hey guys, sorry for the late response.

As far as I know, the URLs should be automatically configured when the AdvancedFilterAdmin is registered. This feature of reversing admin URLs is documented in the official Django docs here.

Currently, django-advanced-filters is designed to only be used inside the admin, and to access the created filters in the admin, our AdvancedFilterAdmin MUST be registered with your admin site. Could it be that either of you is using a different (or multiple) admin site?

@asfaltboy You are right.

I did a admin.site.unregister(AdvancedFilter), because I didn't want to have the Advanced Filters in my admin application list. If I remove this, everything works as expected.

In that case, I'm going to close this issue for now. @filipkilibarda please let us know if you have a different issue, reopen the ticket if some bug remains.

In my case, I had created a custom Django Admin site. Adding:

site.register(AdvancedFilter, AdvancedFilterAdmin)

fixed the issue. Thanks!

@grantjenks thanks for the pointer; by the way, if the documentation can be improved on this matter, I encourage you to contribute 🙏 🙇