0

我正在使用问题5971951中的 render_avatar 标记,因为我遇到了与用户相同的问题。但即使有这样的解决方案,错误也会不断出现!:(

为什么'render_avatar'会期待'endblock'?

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/jorge/

Django Version: 1.4.3
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'dispersion.apps.posts',
 'dispersion.apps.profiles',
 'dispersion.apps.contextualshare',
 'dispersion.apps.index',
 'avatar',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'allauth.socialaccount.providers.openid',
 'allauth.socialaccount.providers.persona')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Template error:
In template /home/jorge/coders/desarrollo/dispersion/dispersion/templates/default/user_profile.html, error at line 37
   Invalid block tag: 'render_avatar', expected 'endblock'
   27 :     <a id="disp-top-bar-login-button" class="disp-top-bar-btn disp-btn" href="#">Iniciar sesión</a>


   28 :     <a id="disp-top-bar-register-button" class="disp-top-bar-btn disp-btn" href="#">Registrarse</a>


   29 :       </div>


   30 :       {% else %}


   31 :       <p>UNA BARRITA PARA EL USUARIO AUTENTICADO NO ESTARIA DEMAS gLOL</p>


   32 :       {% endif %}


   33 :   </div>


   34 : </header>


   35 : <div id="disp-user-header">


   36 :     <!--<div class="disp-user-image-large"></div> <!-- Se busca ayuda con la sintaxis adecuada para posicionar correctamente éste elemento en el HTML -->


   37 :      {% render_avatar avatar 190 %} 


   38 :   <div id="disp-user-custom-wallpaper"></div>


   39 :   <div id="disp-user-bar-wrapper">


   40 :     <div id="disp-user-bar">


   41 :     <div id="disp-user-tabs">


   42 :         <span id="disp-user-posts-button" class="disp-user-tabs-button">Publicaciones</span>


   43 :         <span id="disp-user-about-button" class="disp-user-tabs-button">Sobre Mí</span>


   44 :         <span id="disp-user-photos-button" class="disp-user-tabs-button">Fotos</span>


   45 :         <span id="disp-user-videos-button" class="disp-user-tabs-button">Vídeos</span>


   46 :       </div>


   47 :       <div id="disp-user-name">


Traceback:
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/jorge/coders/desarrollo/dispersion/dispersion/apps/profiles/views.py" in userprofile_view
  51.                     request))
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/shortcuts/__init__.py" in render_to_response
  20.     return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader.py" in render_to_string
  169.         t = get_template(template_name)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader.py" in get_template
  145.     template, origin = find_template(template_name)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader.py" in find_template
  134.             source, display_name = loader(name, dirs)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader.py" in __call__
  42.         return self.load_template(template_name, template_dirs)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader.py" in load_template
  48.             template = get_template_from_string(source, origin, template_name)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader.py" in get_template_from_string
  156.     return Template(source, origin, name)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/base.py" in __init__
  125.         self.nodelist = compile_string(template_string, origin)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/base.py" in compile_string
  153.     return parser.parse()
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/base.py" in parse
  267.                     compiled_result = compile_func(self, token)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader_tags.py" in do_extends
  214.     nodelist = parser.parse()
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/base.py" in parse
  267.                     compiled_result = compile_func(self, token)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/loader_tags.py" in do_block
  189.     nodelist = parser.parse(('endblock',))
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/base.py" in parse
  265.                     self.invalid_block_tag(token, command, parse_until)
File "/home/jorge/coders/desarrollo/dispersion/lib/python2.7/site-packages/Django-1.4.3-py2.7.egg/django/template/base.py" in invalid_block_tag
  320.                 (command, get_text_list(["'%s'" % p for p in parse_until])))

Exception Type: TemplateSyntaxError at /jorge/
Exception Value: Invalid block tag: 'render_avatar', expected 'endblock'

有什么帮助吗?:)

4

1 回答 1

0

你在打电话吗

 {% load avatar_tags %}

在你的模板文件中?

于 2013-01-30T20:33:20.467 回答