On Mon, 2008-04-14 at 17:03 -0700, Simon Tite wrote:
[...]
> However, instead of clicking on submit, I would prefer the user to
> click on just a regular link, so I nead to write something like..
> 
> <code>
> <a href="/i18n/setlang?lang=fr&name=next>Click here for French</a>
> </code>
> 
> which means it will use GET data.

Changing the language changes the state of your application (it displays
it entirely differently, for a start, and may even change the
information that is presented for defaults, etc). That means it is
inappropriate to be done via an HTTP GET, which should not result in any
significant state change. So that's why Django requires a POST there.

(For bonus points, find the one place in Django's code that doesn't obey
this principle. :-( )

If you want to use GET there, you'll need to write your own view.

> The documentation says that redirect to set_language uses POST data,
> so I guess my question could be rephrased as: How do I use a simple
> link to send POST data to the page I am linking to? 

You can't. Href links in HTML are always GET requests. They can
therefore be safely followed by automated processes, etc (cue riotous
laughter from everybody who realises that so many websites don't do
things properly that this isn't true, but the principle is correct).

> And I guess that
> maybe this is not a Django-related question at all!
> 
> Still, maybe one of you kind people can help me or at least point me
> in the right direction.

Use Javascript, or write your own view that is like Django's set
language view but allows GET.

Regards,
Malcolm

-- 
I don't have a solution, but I admire your problem. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
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