NoReverseMatch at /kwalificaties/ Reverse for 'updatekwalificatie' with arguments '('',)' not found.尝试了 1 种模式:
NoReverseMatch at /kwalificaties/ Reverse for 'updatekwalificatie' with arguments '('',)' not found. 1 pattern(s) tried:
views.py
def updateKwalificatie (request, pk):
kwalificatie = Kwalificaties.objects.get(id=pk)
form = kwalificatie_beheer(instance=kwalificatie)
context = {'form': form}
return render(request,'accounts/kwalificatiebeheer.html', context)
urls.py
path('updateKwalificatie/<str:pk>/', views.updateKwalificatie, name='updatekwalificatie'),
kwalificaties.html模板
<div class="card card-body">
<table class="table table-sm">
<tr>
<th>ID</th>
<th>E.H.B.O</th>
<th>Treinen</th>
<th>Extra</th>
<th>update</th>
<th>verwijder</th>
</tr>
{% for i in kwalificaties %}
<tr>
<td>{{i.naam}}</td>
<td>{{i.ehbo}}</td>
<td>{{i.treinen}}</td>
<td>{{i.extra}}</td>
<td><a class="btn btn-sm btn-outline-secondary" href="{% url 'updatekwalificatie' kwalificatie.id %}">Update</a></td>
<td><input type="submit" value="Verwijder"></td>
</tr>
{% endfor %}
heyi 希望有人能帮我解决这个错误,谢谢...................................... ...................................
当您在模板中循环 kwalificaties
时,您将循环命名为 variable/instance i
,您需要在标签中使用此名称或将 i
更改为 kwalificatie
{% for i in kwalificaties %}
<tr>
<td>{{i.naam}}</td>
<td>{{i.ehbo}}</td>
<td>{{i.treinen}}</td>
<td>{{i.extra}}</td>
<td><a class="btn btn-sm btn-outline-secondary" href="{% url 'updatekwalificatie' i.id %}">Update</a></td>
<td><input type="submit" value="Verwijder"></td>
</tr>
{% endfor %}
views.py
def updateKwalificatie (request, pk):
kwalificatie = Kwalificaties.objects.get(id=pk)
form = kwalificatie_beheer(instance=kwalificatie)
context = {'form': form}
return render(request,'accounts/kwalificatiebeheer.html', context)
urls.py
path('updateKwalificatie/<str:pk>/', views.updateKwalificatie, name='updatekwalificatie'),
kwalificaties.html模板
<div class="card card-body">
<table class="table table-sm">
<tr>
<th>ID</th>
<th>E.H.B.O</th>
<th>Treinen</th>
<th>Extra</th>
<th>update</th>
<th>verwijder</th>
</tr>
{% for i in kwalificaties %}
<tr>
<td>{{i.naam}}</td>
<td>{{i.ehbo}}</td>
<td>{{i.treinen}}</td>
<td>{{i.extra}}</td>
<td><a class="btn btn-sm btn-outline-secondary" href="{% url 'updatekwalificatie' kwalificatie.id %}">Update</a></td>
<td><input type="submit" value="Verwijder"></td>
</tr>
{% endfor %}
heyi 希望有人能帮我解决这个错误,谢谢...................................... ...................................
当您在模板中循环 kwalificaties
时,您将循环命名为 variable/instance i
,您需要在标签中使用此名称或将 i
更改为 kwalificatie
{% for i in kwalificaties %}
<tr>
<td>{{i.naam}}</td>
<td>{{i.ehbo}}</td>
<td>{{i.treinen}}</td>
<td>{{i.extra}}</td>
<td><a class="btn btn-sm btn-outline-secondary" href="{% url 'updatekwalificatie' i.id %}">Update</a></td>
<td><input type="submit" value="Verwijder"></td>
</tr>
{% endfor %}