Issue #36 on hold

Caught TypeError while rendering: %d format: a number is required, not unicode

Anonymous created an issue

My model^ {{{

!python

class Group(MP_Node): id = models.CharField(u'Ид', max_length=36, primary_key=True) name = models.CharField(u'Наименование', max_length=200)

node_order_by = ['name']

class Meta:
    verbose_name = u"Группа"
    verbose_name_plural = u"Группы"
    ordering = ()

def __unicode__(self):
    return u"%s %s" % (self.id, self.name)

}}}

Environment:

Request Method: GET Request URL: http://localhost:8000/admin/catalog/group/ Django Version: 1.3 pre-alpha Python Version: 2.7.0 Installed Applications: ['grappelli', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'filebrowser', 'options', 'pytils', 'sorl.thumbnail', 'treebeard', 'catalog', 'easycms', 'clients', 'debug_toolbar'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'easycms.middleware.EasyCMSFallbackMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware')

Template error: In template c:\users\pykab\my documents\aptana studio 3 workspace\larks\lark\src\3rdparty\apps\treebeard\templates\admin\tree_change_list.html, error at line 7 Caught TypeError while rendering: %d format: a number is required, not unicode 1 : {% extends "admin/change_list.html" %}

2 : {% load adminmedia admin_list admin_tree_list i18n %}

3 :

4 :

5 : {% block result_list %}

6 : {% if action_form and actions_on_top and cl.full_result_count %}{% admin_actions %}{% endif %}

7 : {% result_tree cl request %}

8 : {% if action_form and actions_on_bottom and cl.full_result_count %}{% admin_actions %}{% endif %}

9 : {% endblock %}

10 :

Traceback: File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\core\handlers\base.py" in get_response 100. response = callback(request, callback_args, callback_kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\contrib\admin\options.py" in wrapper 239. return self.admin_site.admin_view(view)(*args, kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\utils\decorators.py" in _wrapped_view 76. response = view_func(request, args, kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\views\decorators\cache.py" in _wrapped_view_func 69. response = view_func(request, *args, kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\contrib\admin\sites.py" in inner 190. return view(request, args, kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\utils\decorators.py" in _wrapper 21. return decorator(bound_func)(*args, kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\utils\decorators.py" in _wrapped_view 76. response = view_func(request, args, kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\utils\decorators.py" in bound_func 17. return func(self, *args2, kwargs2) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\contrib\admin\options.py" in changelist_view 1091. ], context, context_instance=context_instance) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\shortcuts__init.py" in render_to_response 20. return HttpResponse(loader.render_to_string(args, kwargs), *httpresponse_kwargs) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\loader.py" in render_to_string 186. return t.render(context_instance) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\test\utils.py" in instrumented_test_render 52. return self.nodelist.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in render 796. bits.append(self.render_node(node, context)) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\debug.py" in render_node 72. result = node.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\loader_tags.py" in render 125. return compiled_parent._render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in _render 167. return self.nodelist.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in render 796. bits.append(self.render_node(node, context)) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\debug.py" in render_node 72. result = node.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\loader_tags.py" in render 125. return compiled_parent._render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in _render 167. return self.nodelist.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in render 796. bits.append(self.render_node(node, context)) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\debug.py" in render_node 72. result = node.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\loader_tags.py" in render 125. return compiled_parent._render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in _render 167. return self.nodelist.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in render 796. bits.append(self.render_node(node, context)) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\debug.py" in render_node 72. result = node.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\loader_tags.py" in render 62. result = block.nodelist.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in render 796. bits.append(self.render_node(node, context)) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\debug.py" in render_node 72. result = node.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\loader_tags.py" in render 62. result = block.nodelist.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in render 796. bits.append(self.render_node(node, context)) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template\debug.py" in render_node 72. result = node.render(context) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\django\template__init.py" in render 927. return func(*resolved_vars) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\treebeard\templatetags\admin_tree_list.py" in result_tree 52. tree = tree + '<li>%s</li>' % subtree(root_node, request) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\treebeard\templatetags\admin_tree_list.py" in subtree 42. tree = tree + '<li>%s</li>' % subtree(subnode, request) File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\treebeard\templatetags\admin_tree_list.py" in subtree 45. return line(node, request) + tree File "C:\Users\PyKaB\My Documents\Aptana Studio 3 Workspace\larks\Lark\src\3rdparty\apps\treebeard\templatetags\admin_tree_list.py" in __line 36. str(node),)

Exception Type: TemplateSyntaxError at /admin/catalog/group/ Exception Value: Caught TypeError while rendering: %d format: a number is required, not unicode

Comments (2)

  1. Anonymous

    I change def line in idmin_tree_list.py and it's work

    def __line(node, request):
        if 't' in request.GET and request.GET['t'] == 'id':
            raw_id_fields = """
            onclick="opener.dismissRelatedLookupPopup(window, '%s'); return false;"
            """ % (node.id,)
        else:
            raw_id_fields = ''
    
        return ('<input type="checkbox" class="action-select" value="%s" '
                'name="_selected_action" /><a href="%s/" %s>%s</a>') % (node.id,
                                                                     node.id,
                                                                     raw_id_fields,
                                                                     node.__unicode__(),)
    
  2. Log in to comment