NoReverseMatch at/

like this

context = {
		'quiz_form': quiz_form,
		
	}
	return render(request, 'quiz/newquiz.html', context)

but in my case {% url 'quiz:new-quiz' course.id module.id %}" i used course.id module.id in newquiz.view it takes two argument: def NewQuiz(request, course_id, module_id
and redirect like return redirect('quiz:new-question', course_id=course_id, module_id=module_id, new_quiz_id=new_quiz.id)
and they do nothing with templates but for the path in which the quiz is belong course and modules respectively

So, where are you providing the necessary values in your context? (Hint, you’re not)

I’m sorry, I can’t really make any sense out of what you’re trying to tell me here, nor can I see how what you have relates to the issue at hand. It appears to me that you’re mixing up two completely different issues or situations.

the same code works perfectly in the same way in other project …let me show you the code and the image
i used in the content template like this

 <li><a href="{% url 'new-quiz' course.id module.id %}">
        Add new quiz</a></li>

in the urls

from django.urls import path
from quiz.views import NewQuiz, NewQuestion, QuizDetail, TakeQuiz, SubmitAttempt, AttemptDetail
urlpatterns = [
	path('<course_id>/modules/<module_id>/quiz/newquiz', NewQuiz, name='new-quiz'),
	path('<course_id>/modules/<module_id>/quiz/<new_quiz_id>/newquestion', NewQuestion, name='new-question'),
	path('<course_id>/modules/<module_id>/quiz/<new_quiz_id>/', QuizDetail, name='quiz-detail'),
	path('<course_id>/modules/<module_id>/quiz/<new_quiz_id>/take', TakeQuiz, name='take-quiz'),
	path('<course_id>/modules/<module_id>/quiz/<new_quiz_id>/take/submit', SubmitAttempt, name='submit-quiz'),
	path('<course_id>/modules/<module_id>/quiz/<new_quiz_id>/<attempt_id>/results', AttemptDetail, name='attempt-detail'),

]

in views

from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseForbidden

from quiz.forms import NewQuizForm, NewQuestionForm
from quiz.models import Answer, Question, Quizzes, Attempter, Attempt
from courses.models import Module
from users.models import CustomUser
#from completion.models import Completion

# Create your views here.

def NewQuiz(request, course_id, module_id):
	user = request.user
	module = get_object_or_404(Module, id=module_id)
	new_quiz=None
	if request.method == 'POST':
		quiz_form = NewQuizForm(request.POST)
		if quiz_form.is_valid():
			new_quiz=quiz_form.save(commit=False)
			new_quiz.module = module
			new_quiz.save()
			return redirect('new-question', course_id=course_id, module_id=module_id, new_quiz_id=new_quiz.id)
	else:
		quiz_form = NewQuizForm()

	context = {
		'quiz_form': quiz_form,
	}
	return render(request, 'quiz/newquiz.html', context)


def NewQuestion(request, course_id, module_id, new_quiz_id):
	user = request.user
	quiz = get_object_or_404(Quizzes, id=new_quiz_id)
	if request.method == 'POST':
		form = NewQuestionForm(request.POST)
		if form.is_valid():
			question_text = form.cleaned_data.get('question_text')
			points = form.cleaned_data.get('points')
			answer_text = request.POST.getlist('answer_text')
			is_correct = request.POST.getlist('is_correct')

			question = Question.objects.create(question_text=question_text, user=user, points=points)

			for a, c in zip(answer_text, is_correct):
				answer = Answer.objects.create(answer_text=a, is_correct=c, user=user)
				question.answers.add(answer)
				question.save()
				quiz.questions.add(question)
				quiz.save()
			return redirect('new-question', course_id=course_id, module_id=module_id, new_quiz_id=new_quiz_id)
	else:
		form = NewQuestionForm()

	context = {
		'form': form,
	}
	return render(request, 'quiz/newquestion.html', context)

as you see this is in the other project and when i clicked add new quiz it worked like this


in this code where is Those parameters (course_id and module.id) supply ? can you show me the difference?

can we have google meeting ?

You’re clearly getting things mixed up here.

Here’s the segment of the template you’ve posted:

Your screen shot has a button labelled “Create new Quiz” - nowhere on that page do you display a link with the text “Add new quiz”.

Now, I am happy to try and help you with this, but we need to stay focused on the issue at hand. I’m not going to get diverted into side issues until the original problem is resolved.

You are also going to need to be more precise and explicit when you’re providing information. Don’t just say “this is my template” - identify the file name. Don’t refer to views as the “create quiz” view - identify it by the function name. I’m not familiar with your application, and it doesn’t help either of us if I need to guess what you’re talking about.

So, from what I can tell so far, you’ve got a portion of a template that looks like this:

I’ll assume that it’s part of the newquiz.html template because you have identified that it gets rendered by this:

As is, this is not going to work because you have not supplied objects in the context to satisfy the url tag in the template.

Whatever data you have in the view to be rendered in the template needs to be defined in the context. If that data is not already part of the context (within quiz_form, since that’s the only data item currently in the context), it needs to be added.

ok what if i changed the quiz.views like this

def NewQuiz(request, courses_id, modules_id):
	user = request.user
	module = get_object_or_404(Modules, id=module_id)
	new_quiz=None
	if request.method == 'POST':
		quiz_form = NewQuizForm(request.POST)
		if quiz_form.is_valid():
			new_quiz=quiz_form.save(commit=False)
			new_quiz.module = module
			new_quiz.save()
			return redirect('quiz:new-question', courses_id=course_id, modules_id=module_id, new_quiz_id=new_quiz.id)
	else:
		quiz_form = NewQuizForm()

	context = {
		'quiz_form': quiz_form,
		'courses_id': courses_id,
		'modules_id': modules_id,
		
	}
	return render(request, 'quiz/newquiz.html', context)

and if you are interested we can communicate via video call or google meeting