0
votes

I want to pass 3 arguments to this path:

path('assignment/<str:class_id>/<str:assignment_id>/<str:edit>', views.assignment, name='teacher-assignment')

Here is the template code:

<a href="{% url 'teacher-assignment' class_id=class_id assignment_id=assignment.id|uuid_to_str edit='edit=false' %}">{{ assignment.assignment_name }}</a>

However, Django throws a no reverse match found error showing only 2 of these arguments listed in the passed arguments. The template url function's comments also show only 2 arguments being passed. How would I pass 3 arguments to the URL dispatcher?

EDIT: Here is the full reverse error: NoReverseMatch at /teacher/assignment/22b95fce8983488db5ca34be80849973/74dba6277a3142d09b1bed77b10bf66f/edit=false Reverse for 'teacher-assignment' with keyword arguments '{'assignment_id': '74dba6277a3142d09b1bed77b10bf66f', 'edit': 'edit=true'}' not found. 1 pattern(s) tried: ['teacher/assignment/(?P[^/]+)/(?P[^/]+)/(?P[^/]+)$']

1
Can you share the full reverse error? I'm pretty sure you can't have = in a valid urlIain Shelvington
Here is the full reverse error: NoReverseMatch at /teacher/assignment/22b95fce8983488db5ca34be80849973/74dba6277a3142d09b1bed77b10bf66f/edit=false Reverse for 'teacher-assignment' with keyword arguments '{'assignment_id': '74dba6277a3142d09b1bed77b10bf66f', 'edit': 'edit=true'}' not found. 1 pattern(s) tried: ['teacher/assignment/(?P<class_id>[^/]+)/(?P<assignment_id>[^/]+)/(?P<edit>[^/]+)$']Achintya Rajan

1 Answers

0
votes

SOLVED! Turns out the reverse error was coming from the HTML file that the reverse was linked to, since when I added a parameter to the url, I didn't check to update the {% url %} statement in the actual html file itself.