On 4/1/07, queezy <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I have this: <form action="http://somewebaddress/"; method="POST">
> and then this:
>
>        <select name="office">
>                               <option value=" " selected>Click here to
> choose</option>
>                               <option value="100">100 Dummy Entry 1</option>
>                               <option value="106">106 Dummy Entry 2</option>
>                               <option value="107">107 Dummy Entry 3</option>
>                             </select>
>
> So it is a drop-down box with office numbers.  The idea is that it goes to
> urls.py:
>
> from django.views.generic.simple import redirect_to
> urlpatterns = patterns('django.views.generic.simple',
>        (r'^$', front),
>        (r'^(?P<id>\d+)/$', 'redirect_to', {'url': '/%(id)s.pdf'}),
>        )
>
> However this cannot work as it goes to the url and tries to pass the
> variable "office" with a given value.  However, when it goes it ends up at
> the url which has nothing after it (because it isn't a GET but a POST) and
> it uses the url pattern "front" to just display the form again.
>
> So I am not seeing how to pass variables and values via POST within the
> Django framework.   Can someone suggest alternative code above so that this
> would work?

This would probably best be handled by wrapping the redirect_to generic view.

#in views.py
from django.views.generic.simple import redirect_to
        
def user_lists(request, id):
    url = '/%ss.pdf'' % id
    return redirect_to(request, url=url)

James Bennet has a nice discussion on how to effectively use this
http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views

~ Anders

>
> Thanks so much!
>
> -Warren
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to