GetUsage/08-03-2011
to match this url i have used following regular expression in urls.py ( python & django)
('^GetData/((0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9]{2})*',GetData)
and inside the views.py following method is configured to accept the date
def GetDataData(request,sdate):
but when i fire following request
http://[ipaddress]/GetUsage/08-03-2011
i am getting following error
GetData() takes exactly 2 arguments (5 given)
as it is counting 08-03-2011 in a seperate 5 parts , but i want to get it in a single parameter i.e. in sdate
Each regexp group within
()is being passed toGetData()as an argument. If you don’t want groups to be generated by some of them, but still want to use parens, use(?:whatever)for non-grouping parens.EDIT: You probably want something like: