If you are planning for reverse URL in your templates, then named URL
pattern is the thing for you.
https://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns

Else to simply, you might also consider changing the url patterns to
something like:
/country/<country-name-or-code>/
/city/<city-name-or-code>/
If you have the opportunity to do so.



On Wed, Aug 10, 2011 at 2:50 PM, samuele.mattiuzzo <samum...@gmail.com>wrote:

> Hi all, i'm developing a search-engine-like application using django
> 1.3 and apache-solr as "database"
>
> I'm now stuck with urls handling. Basically, i need to compose urls
> with the parameters used to query solr. Fair enough, but i faced a
> problem.
>
> Basically, you can filter your results by choosing a country, a city,
> or both (example)
>
> My urls may look like this
>
> url(/<country>/, search_view),
> url(/<city>/, search_view),
> url(/<country>/<city>/, search_view)
>
> as you can see, case 1 and case 2 are a trouble: country and city are
> both strings, how's the url supposed to know if a link pointed to one
> url or another? Should i use named views in templating? What's the
> best way i can use them in my case?
>
> my boss told me to use get requests instead of post, so i could
> explicit the parameters, but SEO experts said "NO WAY!". i don't like
> get method either, but the reason is different :P
> i cannot use get_absolute_url from an object because i have no model
> objects (because, since now, there were no need... just an user object
> used to store some infos, nothing else)
>
> Any hint on how i can do this? Thanks all in advance!
>
> --
> 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.
>
>

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