Django Template Error Could Not Parse The Remainder
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About could not parse the remainder django if Us Learn more about Stack Overflow the company Business Learn more about hiring could not parse the remainder dictionary developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the could not parse the remainder: array Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Could not parse the remainder up
Could Not Parse The Remainder Url
vote 12 down vote favorite 2 i want to compare num and {{buildSummary_list.number}}, but why it is not work? And i got an error Could not parse the remainder: '{{buildSummary_list.number}}' from '{{buildSummary_list.number}}'"... {% for num in buildSummary_list.paginator.page_range %} {% ifequal num {{buildSummary_list.number}} %} {{num}} {% endifequal %} {% ifnotequal num {{buildSummary_list.number}} %} {{num}} {% endifnotequal %} {% endfor %} I want to make the pagination have could not parse the remainder ' ' from 'uid ' effect: pre << 1 2 3 4 5 6 >> next I my code can run, can it make this effect? thanks:D django django-templates share|improve this question edited Apr 8 '14 at 11:27 Joseph the Dreamer 65.3k11103144 asked Aug 25 '10 at 2:57 LoveTW 1,07172039 add a comment| 1 Answer 1 active oldest votes up vote 28 down vote accepted Inside a {% %} tag, variables aren't surrounded by {{. Try this: {% ifequal num buildSummary_list.number %} Also, it looks like your two comparisons can be joined with an else: {% for num in buildSummary_list.paginator.page_range %} {% ifequal num buildSummary_list.number %} {{num}} {% else %} {{num}} {% endifequal %} {% endfor %} share|improve this answer answered Aug 25 '10 at 3:09 Ned Batchelder 178k31338493 3 Wish I could give you a +5. That is not mentioned ANYWHERE! looking again the docs now it seems obvious, but raaaah... –pfctdayelise Aug 25 '10 at 8:24 2 This can also happen if you use {{ }} where you should use {% %} –Benmj Oct 30 '12 at 18:32 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Goo
here for a quick overview of the site Help Center Detailed answers to any templatesyntaxerror django questions you might have Meta Discuss the workings and policies of
Could Not Parse The Remainder Django Date
this site About Us Learn more about Stack Overflow the company Business Learn more about hiring
Could Not Parse The Remainder: '()' Iteritems
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is http://stackoverflow.com/questions/3562559/could-not-parse-the-remainder a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Could not parse the remainder Django up vote 5 down vote favorite I've been trying to write a custom template tag to shorten links with bitly, I've attached the code and http://stackoverflow.com/questions/12134927/could-not-parse-the-remainder-django error I've been getting below. I've tried to look into the documentation provided by Django but cannot see what it is that I am doing wrong. I've put my templatetag in the following layout: scribbler/ models.py templatetags/ __init__.py shortenlink.py views.py the custom tag file that I've written: shortenlink.py from django import template from django.conf import settings from urllib import urlencode from urllib2 import urlopen register = template.Library() @register.simple_tag def bitlyshort(the_url): endpoint = 'https://api-ssl.bitly.com/v3/shorten?access_token={0}&longUrl={1}&format=txt' req = urlencode(endpoint.format(settings.ACCESS_KEY, the_url)) return urlopen(req).read() part of the template that uses the template tag: template {% load shortenlink %}
{{ bitlyshort "http://www.google.com" }}
error TemplateSyntaxError at /user/sankaetp/ Could not parse the remainder: ' "http://www.google.com"' from 'bitlyshort "http://www.google.com"' Request Method: GET Request URL: http://localhost:8000/user/sankaetp/ Django Version: 1.4.1 Exception Type: TemplateSyntaxError Exception Value: Could not parse the remainder: ' "http://www.google.com"' from 'bitlyshort "http://www.google.com"' Exception Location: /Users/sankaetp/virtualenvs/myproject/lib/python2.7/site-packages/django/template/base.py in __init__, line 563 Python Executable: /Users/sankaetp/virtualenvs/myproject/bin/python Python Version: 2.7.3 Python Path: ['/Users/sankaetp/virtualenvs/myproject/bin/django_worksquid', '/Users/sankaetp/virtualenvs/myproject/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/Users/sankaetp/virtualenvs/myproject/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/Users/sankaetp/virtualenvs/myproject/lib/python2.7/site-packages/djangoembed-0.1.1-py2.7.egg', '/Users/sankaetp/virtualenvs/myproject/lib/python2.7/site-packages/httplib2-0.7.4-py2.7.egg', '/Users/sankaetp/virtualenvs/myproject/lib/python2.7/sihere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the http://stackoverflow.com/questions/28859846/could-not-parse-the-remainder-django-template workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join could not them; it only takes a minute: Sign up Could not parse the remainder django template up vote 0 down vote favorite 1 I have a condition within a loop in my template like this: {% for message in message_trash %}