Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

405
Views
Django- Reverse for 'question_detail' with arguments '()' and keyword arguments '{}' not found

When I type the slug in to the url I can see the detail view of that post however, I can't redirect to the newly formed post when it saves into db. The post's are getting saved but on the redirect I keep getting NoReverseMatch Error.

Reverse for 'question_detail' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'(?i)question/(?P<slug>[\w\\-]+)/$']

I can't seem to crack it.

questions-url.py:

url(r'^(?P<slug>[\w\-]+)/$', QuestionDetailView.as_view(), name='question_detail')

views- redirect (after form saved) :

return reverse('questions:question_detail')

views - detail view

class QuestionDetailView(DetailView):
template_name = "questions/question_detail.html"
model = Question
slug_url_kwarg = 'slug'

models.py

def get_absolute_url(self):
    return reverse('questions:question_detail', kwargs={'slug':self.slug, 'question_id':self.id})
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

As the error says, the question_detail pattern expects a slug parameter but you are not passing one. You do so in your get_absolute_url method; you should do the same in your view.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!