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

286
Vistas
Getting "AttributeError: 'str' object has no attribute 'regex'" in Django urls.reverse

As in the title, I'm getting

AttributeError: 'str' object has no attribute 'regex'

I've seen many valid answers to this, but none of them applied to my code as they identified issues in the urls.py file. My issue is in the views.py file.

I get the exception when using reverse to generate a redirect URL:

HttpResponseRedirect(reverse('changetracker:detail', args))

When I use 'changetracker:detail' in other functions, I don't get the exception.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I'm answering this to share knowledge as I didn't see this particular root cause identified already.

The problem turned out to be that I should be using a keyword argument 'args=args' to pass in URL arguments, not a positional argument:

HttpResponseRedirect(reverse('changetracker:detail', args=args))

Using the positional argument (position 2) caused reverse to use that argument as the URL list and thus raise the AttributeError.

about 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