I realise this is likely something trivial I am missing, and I'm aware
of http://code.djangoproject.com/wiki/NewbieMistakes...

However, I have a form that's set up like this:

<form action="/landscape/logs/daterange/" method="POST">From: <input
disabled id="date_from" name="date_from" value="04/25/2007" size="10"
maxlength="12" readonly="readonly" /><img border="0" src="/static/
images/cal.gif" id="date_from_cal" style="cursor: pointer; vertical-
align: top !important;" /><script type="text/
javascript">Calendar.setup({ inputField : "date_from", button :
"date_from_cal" });</script> To: <input disabled id="date_to"
name="date_to" value="04/28/2007" size="10" maxlength="12"
readonly="readonly" /><img border="0" src="/static/images/cal.gif"
id="date_to_cal" style="cursor: pointer; vertical-align: top !
important;" /><script type="text/
javascript">Calendar.setup({ inputField : "date_to", button :
"date_to_cal" });</script> <input type="submit" value="Update Date
Range"> (Oldest Log: Wed, 25 Apr 2007 09:12:26 +2000, Newest Log Fri,
27 Apr 2007 10:31:56 +2000)</form>

my urls.py looks like this:

urlpatterns += patterns('monitor.zopelog.views',
    (r'^landscape/logs/$', 'index'),
    (r'^landscape/logs/(?P<date_from>\d{8})/(?P<date_to>\d{8})/$',
'index'),
    (r'^landscape/logs/daterange/$', 'parsedate'),
)

and here's my parsedate function:

def parsedate(request):

        date_from = request.POST['date_from']
        date_from = date_from.split('/')
        date_to = "%s%s%s" % (date_from[2], date_from[0],
date_from[1])

        date_to = request.POST['date_to']
        date_to = date_to.split('/')
        date_to = "%s%s%s" % (date_to[2], date_to[0], date_to[1])

        return HttpResponseRedirect('/landscape/logs/%s/%s/' %
(date_from, date_to))

However, when I try to submit data from this form I get:

"Key 'date_from' not found in <MultiValueDict: {}>"

Basically telling me there's no post data.

Can anyone let me know what I'm missing. I have the trailing slash,
and I've also tried removing the URL altogether and posting to "" and
then picking up on it there, but no dice...

Thanks for any help.

Tom


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to