Reputation:
I had in my urls.py file, url patterns for certain data processing requirements and later I realized that from among a bunch of them, one was not intended as its requirement had ceased.
However, when I am trying to delete the particular line (the second pattern in the excerpt of the urls.py reproduced here), I am getting the following error at page load ('holding_list'):
NoReverseMatch at /supp/holding_comp/
Reverse for 'holding_change' not found. 'holding_change' is not a valid view function or pattern name.
I have checked all the references (I think) wherever the path might have been referred to (including the related template).
urls.py
path('supp/holding_comp/', views.HoldingListView.as_view(), name='holding_list'),
...
...
path('supp/holding_comp/edit/<int:pk>/', views.HoldingUpdateView.as_view(), name='holding_change'),
How do I delete the second url pattern (the one for "edit" view)?
I tried to look for a similar query but failed to (may be for want of a suitable search string). Any clue will be appreciated.
Upvotes: 2
Views: 1133
Reputation: 476719
Short answer: there are still things referring to the path, and you should find a way to remove these.
This error means that a template, in this case the template rendered by the 'holding_list'
view, contains a {% url ... %}
template tag that refers to that path(..)
.
You thus should search in the template for {% url 'holding_change' ... %}
patterns, and decide what to do with links that refer to that path.
Note that this might not be sufficient: in order to be safe, you should search all templates and all Python files for {% url ... %}
template tags, redirect(..)
s, reverse(..)
s, etc. You probably best search for holding_change
, and thus look what might still refer to that URL.
Upvotes: 0