python - Django template tag to insert or replace URL parameter -
is aware of django template tag takes current path , query string , inserts or replaces query string value?
e.g. given request /some/custom/path?q=how+now+brown+cow&page=3&filter=person
the call {% urlparam 'page' 4 %}
generate /some/custom/path?q=how+now+brown+cow&page=4&filter=person
.
this wouldn't difficult write scratch, seems common task, expect tag built-in. however, after reading through docs , googling, can't seem find anyone's who's publicized such tag.
since haven't used these tools own, i'll refer you:
- django-url-tools has url_params template tag seems want
- django-more-template-tags-and-filters has helper tags manipulating urls , parameters
fyi, i've used jsurl library kind of url manipulations in javascript.
hope helps.
Comments
Post a Comment