Re: writing a urlpattern for a form submission

2009-02-09 Thread Daniel Roseman

On Feb 9, 8:16 pm, kosuke  wrote:
> I'm sure this will come across as basic to many django users but it
> has got me stuck so any helpful pointers would be appreciated.  I've
> scoured the docs and come up empty.  Upfront apologies done now,
> here's what I got:
>
> Using django forms, i create a form which results in a submission
> string like this:
>
> http://127.0.0.1:8000/shiftcalendar/?year=2010=1=Get+cal...
>
> So in my urls.py I set up a urlpattern like this:
>
> urlpatterns = patterns('local1042.shiftcalendar.views',
>     (r'^$', 'index'),
>     (r'^(?P\w+)/(?P\w+)$', 'showcal'),)
>
> I thought that that would do it, and I've tried every variation you
> could think of, but I'm missing something.  I know I should use POST
> but for debugging I've been using GET.  The index page works just
> fine.  I just can't get it to call the showcal function.
>
> Any thoughts would be appreciated.
>
> Thanks. Kevin

URL patterns don't match GET variables - ie anything after the ?. You
just need to match on /shiftcalendar/, and everything else will be
passed as keys in the request.GET dictionary.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



writing a urlpattern for a form submission

2009-02-09 Thread kosuke


I'm sure this will come across as basic to many django users but it
has got me stuck so any helpful pointers would be appreciated.  I've
scoured the docs and come up empty.  Upfront apologies done now,
here's what I got:

Using django forms, i create a form which results in a submission
string like this:

http://127.0.0.1:8000/shiftcalendar/?year=2010=1=Get+calendar

So in my urls.py I set up a urlpattern like this:

urlpatterns = patterns('local1042.shiftcalendar.views',
(r'^$', 'index'),
(r'^(?P\w+)/(?P\w+)$', 'showcal'),)

I thought that that would do it, and I've tried every variation you
could think of, but I'm missing something.  I know I should use POST
but for debugging I've been using GET.  The index page works just
fine.  I just can't get it to call the showcal function.

Any thoughts would be appreciated.

Thanks. Kevin


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