Hi,
I have a custom templatetag function like this:
@register.filter(name='rem_get_request')
def rem_get_request(getrequest,name):
req = getrequest.copy()
for get_item in name.split('&'):
if get_item in req and req[get_item]:
get_item = get_item.strip()
del req[get_item]
if req:
return u"?%s" % (req.urlencode())
return u""
"getrequest" parameter is request.GET
and "name" parameter is the parameters to be removed, splitted by '&'
(ampersand) (ie "min_price&max_price" )
The problem is:
If request.GET has more than 1 parameter (
?tag=mytag&min_price=1000&max_price=1500 ) i can remove one or more
parameters. But if request.GET contains only one parameter (
?tag=mytag ) then it doesnt work. the "if" statement works, but "del"
doesnt work. i cannot remove this last parameter. What am i doing
wrong?
Thanks for your information.
--
You received this message because you are subscribed to the Google Groups
"Django users" 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-users?hl=en.