All of a sudden I am getting the following errors (see below), when I
try and select "Promotions" from the admin area.

I've no idea what this means or how to fix it... can anybody provide
any suggestions?   It's turning into a bad day for me and Django.   As
a newbie to Django and Python and and with limited experience in PHP
I'm finding it very slow going... though I'm trying to persevere.

MerMer

TypeError at /admin/promotions/promotion/
__str__ returned non-string (type long)
Request Method:         GET
Request URL:    http://localhost:8000/admin/promotions/promotion/
Exception Type:         TypeError
Exception Value:        __str__ returned non-string (type long)
Exception Location:
        C:\Python24\lib\site-packages\django_src\django\utils\html.py in
escape, line 27
Template error

In template
C:\Python24\lib\site-packages\django_src\django\contrib\admin\templates\admin/change_list.html,
error at line 17
Caught an exception while rendering: __str__ returned non-string (type
long)
7       {% block coltype %}flex{% endblock %}
8       {% block content %}
9       <div id="content-main">
10      {% if has_add_permission %}
11      <ul class="object-tools"><li><a href="add/{% if is_popup
%}?_popup=1{% endif %}" class="addlink">{% blocktrans with
cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans
%}</a></li></ul>
12      {% endif %}
13      <div class="module{% if cl.has_filters %} filtered{% endif %}"
id="changelist">
14      {% block search %}{% search_form cl %}{% endblock %}
15      {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
16      {% block filters %}{% filters cl %}{% endblock %}
17      {% block result_list %}{% result_list cl %}{% endblock %}
18      {% block pagination %}{% pagination cl %}{% endblock %}
19      </div>
20      </div>
21      {% endblock %}
22
Traceback (innermost last)
Switch to copy-and-paste view

    *
C:\Python24\lib\site-packages\django_src\django\template\__init__.py in
render_node
       699.
       700. def render_node(self, node, context):
       701. return(node.render(context))
       702.
       703. class DebugNodeList(NodeList):
       704. def render_node(self, node, context):
       705. try:
       706. result = node.render(context) ...
       707. except TemplateSyntaxError, e:
       708. if not hasattr(e, 'source'):
       709. e.source = node.source
       710. raise
       711. except Exception, e:
       712. from sys import exc_info
      ▶ Local vars
      Variable  Value
      context
      [{'block': <Block Node: result_list. Contents:
[<django.template.InclusionNode object at 0x016C3490>]>}, {'block':
<Block Node: content. Contents: [<Text Node: ' <div id="content-main">
'>, <If node>, <Text Node: ' <div class="module'>, <If node>, <Text
Node: '" id="changelist"> '>, <Block Node: search. Contents:
[<django.template.InclusionNode object at 0x016C38D0>]>, <Text Node: '
'>, <Block Node: date_hierarchy. Contents:
[<django.template.InclusionNode object at 0x016C3450>]>, <Text Node: '
'>, <Block Node: filters. Contents: [<django.template.InclusionNode
object at 0x016C39B0>]>, <Text Node: ' '>, <Block Node: result_list.
Contents: [<django.template.InclusionNode object at 0x016C3490>]>,
<Text Node: ' '>, <Block Node: pagination. Contents:
[<django.template.InclusionNode object at 0x016C3310>]>, <Text Node: '
</div> </div> '>]>}, {}, {'has_add_permission': True}, {'LANGUAGES':
(('ar', 'Arabic'), ('bn', 'Bengali'), ('cs', 'Czech'), ('cy', 'Welsh'),
('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'),
('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'), ('fi', 'Finnish'),
('fr', 'French'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he',
'Hebrew'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'),
('nl', 'Dutch'), ('no', 'Norwegian'), ('pt-br', 'Brazilian'), ('ro',
'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'),
('sr', 'Serbian'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('tr',
'Turkish'), ('uk', 'Ukrainian'), ('zh-cn', 'Simplified Chinese'),
('zh-tw', 'Traditional Chinese')), 'LANGUAGE_BIDI': False,
'LANGUAGE_CODE': 'en-us'}, {}, {'perms':
<django.core.context_processors.PermWrapper object at 0x016DFE10>,
'messages': [], 'user': <User: merric>}, {'cl':
<django.contrib.admin.views.main.ChangeList object at 0x016D98B0>,
'is_popup': False, 'title': 'Select promotion to change'}]
      e
      <exceptions.TypeError instance at 0x01680FA8>
      exc_info
      <built-in function exc_info>
      node
      <django.template.InclusionNode object at 0x016C3490>
      self
      [<django.template.InclusionNode object at 0x016C3490>]
      wrapped
      <django.template.TemplateSyntaxError instance at 0x01680F80>
    *
C:\Python24\lib\site-packages\django_src\django\template\__init__.py in
render
       855. def render(self, context):
       856. resolved_vars = [resolve_variable(var, context) for var in
self.vars_to_resolve]
       857. if takes_context:
       858. args = [context] + resolved_vars
       859. else:
       860. args = resolved_vars
 861.
       862. dict = func(*args) ...
       863.
       864. if not getattr(self, 'nodelist', False):
       865. from django.template.loader import get_template
       866. t = get_template(file_name)
       867. self.nodelist = t.nodelist
       868. return self.nodelist.render(context_class(dict))
      ▶ Local vars
      Variable  Value
      args
      [<django.contrib.admin.views.main.ChangeList object at
0x016D98B0>]
      context
      [{'block': <Block Node: result_list. Contents:
[<django.template.InclusionNode object at 0x016C3490>]>}, {'block':
<Block Node: content. Contents: [<Text Node: ' <div id="content-main">
'>, <If node>, <Text Node: ' <div class="module'>, <If node>, <Text
Node: '" id="changelist"> '>, <Block Node: search. Contents:
[<django.template.InclusionNode object at 0x016C38D0>]>, <Text Node: '
'>, <Block Node: date_hierarchy. Contents:
[<django.template.InclusionNode object at 0x016C3450>]>, <Text Node: '
'>, <Block Node: filters. Contents: [<django.template.InclusionNode
object at 0x016C39B0>]>, <Text Node: ' '>, <Block Node: result_list.
Contents: [<django.template.InclusionNode object at 0x016C3490>]>,
<Text Node: ' '>, <Block Node: pagination. Contents:
[<django.template.InclusionNode object at 0x016C3310>]>, <Text Node: '
</div> </div> '>]>}, {}, {'has_add_permission': True}, {'LANGUAGES':
(('ar', 'Arabic'), ('bn', 'Bengali'), ('cs', 'Czech'), ('cy', 'Welsh'),
('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'),
('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'), ('fi', 'Finnish'),
('fr', 'French'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he',
'Hebrew'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'),
('nl', 'Dutch'), ('no', 'Norwegian'), ('pt-br', 'Brazilian'), ('ro',
'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'),
('sr', 'Serbian'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('tr',
'Turkish'), ('uk', 'Ukrainian'), ('zh-cn', 'Simplified Chinese'),
('zh-tw', 'Traditional Chinese')), 'LANGUAGE_BIDI': False,
'LANGUAGE_CODE': 'en-us'}, {}, {'perms':
<django.core.context_processors.PermWrapper object at 0x016DFE10>,
'messages': [], 'user': <User: merric>}, {'cl':
<django.contrib.admin.views.main.ChangeList object at 0x016D98B0>,
'is_popup': False, 'title': 'Select promotion to change'}]
      context_class
      <class 'django.template.context.Context'>
      file_name
      'admin/change_list_results.html'
      func
      <function result_list at 0x0166C4B0>
      resolved_vars
      [<django.contrib.admin.views.main.ChangeList object at
0x016D98B0>]
      self
      <django.template.InclusionNode object at 0x016C3490>
      takes_context
      False
      var
      'cl'
    *
C:\Python24\lib\site-packages\django_src\django\contrib\admin\templatetags\admin_list.py
in result_list
       175. yield ('<td%s>%s</td>' % (row_class, result_repr))
       176.
       177. def results(cl):
       178. for res in cl.result_list:
       179. yield list(items_for_result(cl,res))
       180.
       181. def result_list(cl):
       182. return {'cl': cl, ...
       183. 'result_headers': list(result_headers(cl)),
       184. 'results': list(results(cl))}
       185. result_list =
register.inclusion_tag("admin/change_list_results.html")(result_list)
       186.
       187. def date_hierarchy(cl):
       188. if cl.lookup_opts.admin.date_hierarchy:
      ▶ Local vars
      Variable  Value
      cl
      <django.contrib.admin.views.main.ChangeList object at 0x016D98B0>
    *
C:\Python24\lib\site-packages\django_src\django\contrib\admin\templatetags\admin_list.py
in results
       172. yield ('<%s%s><a href="%s"%s>%s</a></%s>' % \
       173. (table_tag, row_class, url, (cl.is_popup and '
onclick="opener.dismissRelatedLookupPopup(window, %r); return false;"'
% result_id or ''), result_repr, table_tag))
       174. else:
       175. yield ('<td%s>%s</td>' % (row_class, result_repr))
       176.
       177. def results(cl):
       178. for res in cl.result_list:
       179. yield list(items_for_result(cl,res)) ...
       180.
       181. def result_list(cl):
       182. return {'cl': cl,
       183. 'result_headers': list(result_headers(cl)),
       184. 'results': list(results(cl))}
       185. result_list =
register.inclusion_tag("admin/change_list_results.html")(result_list)
      ▶ Local vars
      Variable  Value
      cl
      <django.contrib.admin.views.main.ChangeList object at 0x016D98B0>
      res
      <Promotion: Spa Day>
    *
C:\Python24\lib\site-packages\django_src\django\contrib\admin\templatetags\admin_list.py
in items_for_result
       125. if not allow_tags:
       126. result_repr = escape(result_repr)
       127. else:
       128. field_val = getattr(result, f.attname)
       129.
       130. if isinstance(f.rel, models.ManyToOneRel):
       131. if field_val is not None:
       132. result_repr = escape(getattr(result, f.name)) ...
       133. else:
       134. result_repr = EMPTY_CHANGELIST_VALUE
       135. # Dates and times are special: They're formatted in a
certain way.
       136. elif isinstance(f, models.DateField) or isinstance(f,
models.TimeField):
       137. if field_val:
       138. (date_format, datetime_format, time_format) =
get_date_formats()
      ▶ Local vars
      Variable  Value
      cl
      <django.contrib.admin.views.main.ChangeList object at 0x016D98B0>
      f
      <django.db.models.fields.related.ForeignKey object at 0x014B0430>
      field_name
      'promoter_id'
      field_val
      5L
      first
      False
      pk
      'id'
      result
      <Promotion: Spa Day>
      result_id
      '9'
      result_repr
      'Spa Day'
      row_class
      ''
      table_tag
      'th'
      url
      '9/'
    * C:\Python24\lib\site-packages\django_src\django\utils\html.py in
escape
        20. hard_coded_bullets_re =
re.compile(r'((?:<p>(?:%s).*?[a-zA-Z].*?</p>\s*)+)' %
'|'.join([re.escape(x) for x in DOTS]), re.DOTALL)
        21. trailing_empty_content_re =
re.compile(r'(?:<p>(?:&nbsp;|\s|<br \/>)*?</p>\s*)+\Z')
        22. del x # Temporary variable
        23.
        24. def escape(html):
        25. "Returns the given HTML with ampersands, quotes and carets
encoded"
        26. if not isinstance(html, basestring):
        27. html = str(html) ...
        28. return html.replace('&', '&amp;').replace('<',
'&lt;').replace('>', '&gt;').replace('"', '&quot;').replace("'",
'&#39;')
        29.
        30. def linebreaks(value):
        31. "Converts newlines into <p> and <br />s"
        32. value = re.sub(r'\r\n|\r|\n', '\n', value) # normalize
newlines
        33. paras = re.split('\n{2,}', value)
      ▶ Local vars


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to