Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

411
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda