I'm a new face to Django so please be considerate to if ever my problem is something stupid. So I have been practicing Django, and currently making a CRUD, however I've run into problems with tegards to NoReverseMatch, I went through answers in stackoverflow but still I couldn't find where I went wrong. Can you help me a bit guys? Actually it was working, when I resetted the DB, somehow it had the error, maybe i moved something or whatever unlucky thing i did. I've been at it for 3 hours actually. Just this error. So please help me:
The traceback says that the NoReverseMatch is on the following url:
<a href="{%url 'deleted'%}">Delete</a>
which I properly partnered and connected with the following in my urls.py.
url(r'^delete/(?P<pk>\d+)/', Delete.as_view(), name="deleted"),
Here's the gist of the code:
deleteupdate/urls.py (Delete and Update are from models imported to the file)
urlpatterns = [
url(r'^', views.list, name='list'),
url(r'^delete/(?P<pk>\d+)/', Delete.as_view(), name="deleted"),
url(r'^update/(?P<pk>\d+)/', Update.as_view(), name="updated"),
url(r'^(?P<student_id>)/', views.detail, name='detail'),
]
main/urls.py
urlpatterns = [
url(r'^$', include('index.urls')),
url(r'^admin/', admin.site.urls),
url(r'^list/', include('deleteupdate.urls')),
]
Here's the HTML:
{% if all_students %}
<ul>
{% for user in all_users %}
<li><a href="/list/{{ user.id }}"></a>
<button type="button">
<a href="{%url 'deleted'%}">Delete</a>
</button>
<button type="button">
<a href='{% url 'updated' %}'>Update</a>
</button>
{% endfor%}
</ul>
{% else %}
<h3>Users is empty</h3>
{% endif %}
What am I doing wrong? I think I have followed every advice I could find, but yeah it still gives me the error. Any help is appreciated. Thank you very much!
Here's the error btw:
NoReverseMatch at /list/
Reverse for 'deleted' with no arguments not found. 1 pattern(s) tried: ['list/delete/(?P\d+)/']