On Friday, March 18, 2011 10:34:03 AM UTC, Christophe wrote:
>
> Hi All, 
>
> I did not find anything about that topic so I am probably missing one 
> big thing here. I would be really glad to have your opinion so first 
> let me start by quoting the Djangobook: 
>
> """ 
> A Word About Pretty URLs 
>
> If you’re experienced in another Web development platform, such as PHP 
> or Java, you may be thinking, “Hey, let’s use a query string 
> parameter!” — something like /time/plus?hours=3, in which the hours 
> would be designated by the hours parameter in the URL’s query string 
> (the part after the ?). 
>
> You can do that with Django (and we’ll tell you how in Chapter 7), but 
> one of Django’s core philosophies is that URLs should be beautiful. 
> The URL /time/plus/3/ is far cleaner, simpler, more readable, easier 
> to recite to somebody aloud and … just plain prettier than its query 
> string counterpart. Pretty URLs are a characteristic of a quality Web 
> application. 
> """ 
>
> So my question is: assuming you have a form within the view triggered 
> by the "/time/plus/3/" call, how do you avoid putting an absolute path 
> in the form action field? All that because of slashes in the calling 
> url. That is so, so, so ugly that it deprecates completely the 
> advantage of having nice urls based on slashes. Or am I missing 
> something? 
>
> Of course having the root url in a global parameter is not an option 
> if we stick to prettiness requirement. Using something else than a 
> slash as a special character may be? 
>
> Many thanks for sharing your opinion! 
>

I don't understand your problem at all. Why does the structure of the URL 
change in any way what you put into the form action field?

Usually in Django, as in many other frameworks, forms post to the same URL 
as they were originally served from, and the view distinguishes between GET 
and POST in order to process them correctly. This means that you usually 
just put "." as the form's action.

Additionally, Django discourages putting hard-coded urls into templates in 
any case, in favour of dynamically-calculated ones via the {% url %} tag.
--
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.

Reply via email to