Wednesday, December 24, 2014

How to capture any incorrect typing of a url and pass it to a default page

I want to code the such that if someone types in any garbage inn the browser the final line of the url router will grab the line and reroute it to some page(the home page) for example.

I added the following line of code to the bottom of the url  

url(r'^([a-zA-Z0-9\-\_]*)', views.my_default),   expecting that it would send it to my default view

So, it appears to be working and  not matching anything above that  url and falls all the way through, however I am getting any error

TypeError at /waitlist/dict

my_default() takes exactly 1 argument (2 given)

My view is very simple

def my_default_2(request):      context = RequestContext(request)      context_dict = {'boldmessage': "pass through from waitlist"}      return render_to_response('waitlist/home.html', context_dict, context)

So, it looks like it is getting to the view, but I am getting the error above.
Any suggestions as to why I am getting the argument error above.


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment