Is there a way to get the current page URL and all its parameters in a Django template?
For example, a templatetag that would print a full URL like /foo/bar?p
In addtition to sdolan's answer:
if you are using I18N and would like to pass next value to /i18n/setlang/ to change the language of the current page, then you will need to strip off current language code from the full path either. Something like:
full_path = request.get_full_path()
current_path = full_path[full_path.index('/', 1):]
This assumes that every path has format /LANG_CODE/any/other/stuff/with/?param='yay' and simply kicks off LANG_CODE whatever it is (e.g., /en/ will result into /).