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 8574471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:28:55+00:00 2026-06-11T19:28:55+00:00

Possible Duplicate: Capturing url parameters in request.GET I’m designing a detail page of my

  • 0

Possible Duplicate:
Capturing url parameters in request.GET

I’m designing a detail page of my website by using django, and set the Topic Url as following:

(r'd/\d+/$', 'xiangwww.detail.views.detail'),

the second argument is the ID of the topic.
But when I fetch it following the guide of Django Book :

def detail(request,offset):
    print offset
    return render_to_response('detail.html')

The page “localhost:8000/d/1/” in shows the TypeError:
detail() takes exactly 2 arguments (1 given)

It seems Django can’t recognise what is offset in my views.py file, how to solve it?

  • 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-06-11T19:28:56+00:00Added an answer on June 11, 2026 at 7:28 pm

    You need to capture the number, by putting it in a regular expression group:

    (r'd/(\d+)/$', 'xiangwww.detail.views.detail'),
    

    Without the (...) group, Django does not know about the captured number and cannot pass it to your view. See the URL Dispatch documentation:

    To capture a value from the URL, just put parenthesis around it.

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

Sidebar

Related Questions

Possible Duplicate: How do I make a request using HTTP basic authentication with PHP
Possible Duplicate: Opening url in new tab while i am doing window.open(), my page
Possible Duplicate: caching JavaScript files I'm using JQuery 1.7.2 into JSF page. I call
Possible Duplicate: lambdas require capturing 'this' to call static member function? I want to
Possible Duplicate: Running a command from Ruby displaying and capturing the output I have
Possible Duplicate: PHP get all arguments as array? Within a javascript function arguments always
Possible Duplicate: regex for URL including query string I have a text or message.
Possible Duplicate: thread with multiple parameters How does one thread a sub with two
Possible Duplicate: Unable to get a list of installed Python modules How do I
Possible Duplicate: Calling camera from an activity, capturing an image and uploading to a

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.