Hi,
I need similar functionality so I develop custom tag "qs" wich is not
tight to paginator (I don't know if it is better or not)

Used that way:
<a href="{% url list %}{% qs params p=pager.previous_page_number %}">

params ... dictionary with query string parameters which was prepared
in view
p ... any amount of other query string parameters as key=value you
want to set directly in template


For filtering query string parameters in views for using them as
parameters in ORM, redirects etc I use function "dict_pass()" with
this pattern:

search_params = ('a_day', 'a_month', 'd_day', 'd_month',
'guest_count', 'bedrooms', 'p', 'o', 'ot', 'short') #allowed params
params = dict_pass(request.GET, search_params, updated_params)

It returns dictionary of parameters of "request.GET" updated from
"updated_params" and filtered to have only allowed params here as
"search_params".


I think Django as a web framework could have an object oriented
representation of URI in core to simplify the work with url. It should
be easy to set, update and get the whole url as a string and also url
parts (host, port, path, etc.) and query string parameters in some
clever way without bunch of conditions in application code needed. And
also maybe help with proper escaping of urls with not ascii chars to
render them in templates.

Some inspiration from other web frameworks:
http://api.nettephp.com/0.9/Nette-Web/Uri.html
http://corelib.rubyonrails.org/classes/URI/Generic.html
http://framework.zend.com/manual/en/zend.uri.html


I think also get_absolute_url proposal and future url routing
enhancements could benefit from it.

Cheers,
Vaclav

--

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


Reply via email to