Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6016631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:00:38+00:00 2026-05-23T03:00:38+00:00

I try to do flexible url. I did it this way url(r’^(&\w*)?/?$’, direct_to_template, {‘template’:

  • 0

I try to do flexible url. I did it this way

url(r'^(&\w*)?/?$', direct_to_template,
    {'template': 'basic.djhtml'}),

get_absolute_url

def get_absolute_url(self):
    return "/&%s" % self.human_redble_url

The problem is an error:

direct_to_template() got multiple values for keyword argument ‘template’

What does it mean? How could I fix it?

In Python interactive interpretor this regexp works

>>> import re
>>> reg = re.compile('^(&\w*)?/?$')
>>> result = reg.match('&post1')
>>> result
<_sre.SRE_Match object at 0xb77098a0>
>>> wrong = reg.match('aergsr')
>>> print wrong
None
>>> reg.match('post1')
>>> print reg.match('post1')
None
>>> print reg.match('&post1/')
<_sre.SRE_Match object at 0xb77097a0>
>>> print reg.match('&post1:')
None 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:00:39+00:00Added an answer on May 23, 2026 at 3:00 am

    I don’t understand what that ampersand is doing there, but never mind.

    I suspect the problem is that you have not used named groups in your URL. So the captured string is being sent through to the view function as the first positional argument, which is actually template, so it conflicts with the template keyword arg.

    Use a named group – &(?P<my_arg>\w*)?/?$ – and it should work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This has to do w/ Amazon's Flexible Payment service: In order to try to
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]
try: recursive_function() except RuntimeError e: # is this a max. recursion depth exceeded exception?
I'm trying to construct the flexible URL routing. So the url like en-US/ctrl/act/1/2 should
I try to create a flexible frame for in my iPhone app with some
I had trouble coming up with a good way to word this question, so
Try this in chrome versus firefox/IE: var cancelPressed = false; function redirect() { //window.location
I want to make my rails controller more flexible and try to create some
So, I've got this Phaser that is really flexible but it seems I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.