вьюху 1 аргумент так:
href={% url "delete-urok" urok.id %}
хочу передать еще и subject_id.
Как это сделать?
через пробел после первого аргумента
template <a href="{% url 'delete-urok' urok.id subject_id %}" class="btn btn-outline-danger btn-sm">Удалить урок</a><br><br> urls.py path('delete_urok/', views.delete_urok, name="delete-urok"), view.py def delete_urok(request, urok_id, subject_id): urok = Uroki.objects.get(pk=urok_id) urok.delete() # return redirect("subject_names") return redirect(f"uroki/{subject_id}/") Ошибка: NoReverseMatch at /uroki/1/ Reverse for 'delete-urok' with arguments '(1, 1)' not found. 1 pattern(s) tried: ['delete_urok/$'] Request Method: GET Request URL: http://127.0.0.1:8000/uroki/1/ Django Version: 3.2.7 Exception Type: NoReverseMatch Exception Value: Reverse for 'delete-urok' with arguments '(1, 1)' not found. 1 pattern(s) tried: ['delete_urok/$'] Exception Location: C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py, line 694, in _reverse_with_prefix Python Executable: C:\Users\User\AppData\Local\Programs\Python\Python39\python.exe Python Version: 3.9.7 Python Path: ['C:\\Users\\User\\Desktop\\Rasul\\Python\\Django\\Coding_wars\\project\\cw', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python39\\python39.zip', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python39\\DLLs', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python39\\lib', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python39', 'C:\\Users\\User\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages'] Server time: Mon, 27 Sep 2021 17:42:05 +0000
а во views.py в паттерне для этого урл указано два параметра?
Обсуждают сегодня