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

278
Views
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 answers
Answer question

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 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!