Opened 17 years ago

Closed 17 years ago

#5193 closed (invalid)

TinyMCE problem

Reported by: stephanerufer@… Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
Severity: Keywords: tinymce
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

i tried installing tinymce with django, but i seem to have a problem with the js import. i tried to google of another tutorial...but alas nothing seemed to work. in your tutorial (http://code.djangoproject.com/wiki/AddWYSIWYGEditor) there are paths that i do not have, idk if i'm looking in the wrong direction...i am sort of new to django. This is the error i get:

Template error

In template c:\python25\lib\site-packages\django\contrib\admin\templates\admin\change_form.html, error at line 5
Caught an exception while rendering: expected string or buffer
1 {% extends "admin/base_site.html" %}
2 {% load i18n admin_modify adminmedia %}
3 {% block extrahead %}{{ block.super }}
4 <script type="text/javascript" src="../../../jsi18n/"></script>
5 {% for js in javascript_imports %}{% include_admin_script js %}{% endfor %}
6 {% endblock %}
7 {% block stylesheet %}{% admin_media_prefix %}css/forms.css{% endblock %}
8 {% block coltype %}{% if ordered_objects %}colMS{% else %}colM{% endif %}{% endblock %}
9 {% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
10 {% block userlinks %}<a href="../../../doc/">{% trans 'Documentation' %}</a> / <a href="../../../password_change/">{% trans 'Change password' %}</a> / <a href="../../../logout/">{% trans 'Log out' %}</a>{% endblock %}
11 {% block breadcrumbs %}{% if not is_popup %}
12 <div class="breadcrumbs">
13 <a href="../../../">{% trans "Home" %}</a> &rsaquo;
14 <a href="../">{{ opts.verbose_name_plural|capfirst|escape }}</a> &rsaquo;
15 {% if add %}{% trans "Add" %} {{ opts.verbose_name|escape }}{% else %}{{ original|truncatewords:"18"|escape }}{% endif %}
Traceback (innermost last)
Switch to copy-and-paste view

  • c:\Python25\lib\site-packages\django\template\init.py in render_node

747.

  1. def render_node(self, node, context):
  2. return node.render(context) 750.
  3. class DebugNodeList(NodeList):
  4. def render_node(self, node, context):
  5. try:
  6. result = node.render(context) ...
  7. except TemplateSyntaxError, e:
  8. if not hasattr(e, 'source'):
  9. e.source = node.source
  10. raise
  11. except Exception, e:
  12. from sys import exc_info

▶ Local vars
Variable Value
context
[{'forloop': {'parentloop': {}, 'last': True, 'counter': 5, 'revcounter0': 0, 'revcounter': 1, 'counter0': 4, 'first': False}, u'js': ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')}, {'block': <Block Node: extrahead. Contents: [<Variable Node: block.super>, <Text Node: ' <script type="text/javas'>, <For Node: for js in javascript_imports, tail_len: 1>, <Text Node: ' '>]>}, {}, {'form_url': , 'ordered_objects': [], 'has_file_field': False, 'has_change_permission': True, 'content_type_id': 8L, 'first_form_field_id': 'id_question', 'bound_field_sets': [<django.contrib.admin.views.main.AdminBoundFieldSet object at 0x0180ED70>, <django.contrib.admin.views.main.AdminBoundFieldSet object at 0x0180EAD0>], 'auto_populated_fields': [], 'add': False, 'change': True, 'javascript_imports': ['js/core.js', 'js/admin/RelatedObjectLookups.js', 'js/calendar.js', 'js/admin/DateTimeShortcuts.js', ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')], 'opts': <Options for Poll>, 'inline_related_objects': [<RelatedObject: polls:choice related to poll>], 'has_absolute_url': False, 'has_delete_permission': True}, {'MEDIA_URL': }, {'LANGUAGES': (('ar', 'Arabic'), ('bn', 'Bengali'), ('bg', 'Bulgarian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he', 'Hebrew'), ('hr', 'Croatian'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ko', 'Korean'), ('kn', 'Kannada'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('nl', 'Dutch'), ('no', 'Norwegian'), ('pl', 'Polish'), ('pt', 'Portugese'), ('pt-br', 'Brazilian'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sr', 'Serbian'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('te', 'Telugu'), ('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 0x0180E650>, 'messages': [], 'user': <User: django>}, {'is_popup': False, 'original': <Poll: hey>, 'object_id': u'4', 'form': {'error_dict': {}, 'edit_inline': True, '_inline_collections': None, 'manipulator': <django.db.models.manipulators.ChangeManipulator object at 0x0181BFB0>, 'order_objects': [], 'data': {'choice.0.choice': , 'choice.0.votes': None, 'pub_date_date': '2007-08-15', 'choice.0.id': None, 'question': u'hey', 'id': 4L, 'pub_date_time': '15:55:09'}, 'original': <Poll: hey>}, 'title': u'Change poll'}]
e
TypeError('expected string or buffer',)
exc_info
<built-in function exc_info>
node
<For Node: for js in javascript_imports, tail_len: 1>
self
[<Variable Node: block.super>, <Text Node: ' <script type="text/javas'>, <For Node: for js in javascript_imports, tail_len: 1>, <Text Node: ' '>]
wrapped
TemplateSyntaxError('Caught an exception while rendering: expected string or buffer',)

  • c:\Python25\lib\site-packages\django\template\defaulttags.py in render
    1. }
    2. if unpack:
    3. # If there are multiple loop variables, unpack the item into them.
    4. context.update(dict(zip(self.loopvars, item)))
    5. else:
    6. context[self.loopvars[0]] = item
    7. for node in self.nodelist_loop:
    8. nodelist.append(node.render(context)) ...
    9. if unpack:
    10. # The loop variables were pushed on to the context so pop them
    11. # off again. This is necessary because the tag lets the length
    12. # of loopvars differ to the length of each set of items and we
    13. # don't want to leave any vars from the previous loop on the
    14. # context.
    ▶ Local vars Variable Value context [{'forloop': {'parentloop': {}, 'last': True, 'counter': 5, 'revcounter0': 0, 'revcounter': 1, 'counter0': 4, 'first': False}, u'js': ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')}, {'block': <Block Node: extrahead. Contents: [<Variable Node: block.super>, <Text Node: ' <script type="text/javas'>, <For Node: for js in javascript_imports, tail_len: 1>, <Text Node: ' '>]>}, {}, {'form_url': , 'ordered_objects': [], 'has_file_field': False, 'has_change_permission': True, 'content_type_id': 8L, 'first_form_field_id': 'id_question', 'bound_field_sets': [<django.contrib.admin.views.main.AdminBoundFieldSet object at 0x0180ED70>, <django.contrib.admin.views.main.AdminBoundFieldSet object at 0x0180EAD0>], 'auto_populated_fields': [], 'add': False, 'change': True, 'javascript_imports': ['js/core.js', 'js/admin/RelatedObjectLookups.js', 'js/calendar.js', 'js/admin/DateTimeShortcuts.js', ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')], 'opts': <Options for Poll>, 'inline_related_objects': [<RelatedObject: polls:choice related to poll>], 'has_absolute_url': False, 'has_delete_permission': True}, {'MEDIA_URL': }, {'LANGUAGES': (('ar', 'Arabic'), ('bn', 'Bengali'), ('bg', 'Bulgarian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he', 'Hebrew'), ('hr', 'Croatian'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ko', 'Korean'), ('kn', 'Kannada'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('nl', 'Dutch'), ('no', 'Norwegian'), ('pl', 'Polish'), ('pt', 'Portugese'), ('pt-br', 'Brazilian'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sr', 'Serbian'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('te', 'Telugu'), ('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 0x0180E650>, 'messages': [], 'user': <User: django>}, {'is_popup': False, 'original': <Poll: hey>, 'object_id': u'4', 'form': {'error_dict': {}, 'edit_inline': True, '_inline_collections': None, 'manipulator': <django.db.models.manipulators.ChangeManipulator object at 0x0181BFB0>, 'order_objects': [], 'data': {'choice.0.choice': , 'choice.0.votes': None, 'pub_date_date': '2007-08-15', 'choice.0.id': None, 'question': u'hey', 'id': 4L, 'pub_date_time': '15:55:09'}, 'original': <Poll: hey>}, 'title': u'Change poll'}] i 4 item ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js') len_values 5 node <django.template.SimpleNode object at 0x01815950> nodelist [u'<script type="text/javascript" src="/media/js/core.js"></script>', u'<script type="text/javascript" src="/media/js/admin/RelatedObjectLookups.js"></script>', u'<script type="text/javascript" src="/media/js/calendar.js"></script>', u'<script type="text/javascript" src="/media/js/admin/DateTimeShortcuts.js"></script>'] parentloop {} self <For Node: for js in javascript_imports, tail_len: 1> unpack False values ['js/core.js', 'js/admin/RelatedObjectLookups.js', 'js/calendar.js', 'js/admin/DateTimeShortcuts.js', ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')]
  • c:\Python25\lib\site-packages\django\template\init.py in render

865.

  1. class SimpleNode(Node):
  2. def init(self, vars_to_resolve):
  3. self.vars_to_resolve = vars_to_resolve 869.
  4. def render(self, context):
  5. resolved_vars = [resolve_variable(var, context) for var in self.vars_to_resolve]
  6. return func(*resolved_vars) ... 873.
  7. compile_func = curry(generic_tag_compiler, params, defaults, getattr(func, "_decorated_function", func).name, SimpleNode)
  8. compile_func.doc = func.doc
  9. self.tag(getattr(func, "_decorated_function", func).name, compile_func)
  10. return func

878.

▶ Local vars
Variable Value
context
[{'forloop': {'parentloop': {}, 'last': True, 'counter': 5, 'revcounter0': 0, 'revcounter': 1, 'counter0': 4, 'first': False}, u'js': ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')}, {'block': <Block Node: extrahead. Contents: [<Variable Node: block.super>, <Text Node: ' <script type="text/javas'>, <For Node: for js in javascript_imports, tail_len: 1>, <Text Node: ' '>]>}, {}, {'form_url': , 'ordered_objects': [], 'has_file_field': False, 'has_change_permission': True, 'content_type_id': 8L, 'first_form_field_id': 'id_question', 'bound_field_sets': [<django.contrib.admin.views.main.AdminBoundFieldSet object at 0x0180ED70>, <django.contrib.admin.views.main.AdminBoundFieldSet object at 0x0180EAD0>], 'auto_populated_fields': [], 'add': False, 'change': True, 'javascript_imports': ['js/core.js', 'js/admin/RelatedObjectLookups.js', 'js/calendar.js', 'js/admin/DateTimeShortcuts.js', ('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')], 'opts': <Options for Poll>, 'inline_related_objects': [<RelatedObject: polls:choice related to poll>], 'has_absolute_url': False, 'has_delete_permission': True}, {'MEDIA_URL': }, {'LANGUAGES': (('ar', 'Arabic'), ('bn', 'Bengali'), ('bg', 'Bulgarian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('es', 'Spanish'), ('es_AR', 'Argentinean Spanish'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('gl', 'Galician'), ('hu', 'Hungarian'), ('he', 'Hebrew'), ('hr', 'Croatian'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ko', 'Korean'), ('kn', 'Kannada'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('nl', 'Dutch'), ('no', 'Norwegian'), ('pl', 'Polish'), ('pt', 'Portugese'), ('pt-br', 'Brazilian'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sr', 'Serbian'), ('sv', 'Swedish'), ('ta', 'Tamil'), ('te', 'Telugu'), ('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 0x0180E650>, 'messages': [], 'user': <User: django>}, {'is_popup': False, 'original': <Poll: hey>, 'object_id': u'4', 'form': {'error_dict': {}, 'edit_inline': True, '_inline_collections': None, 'manipulator': <django.db.models.manipulators.ChangeManipulator object at 0x0181BFB0>, 'order_objects': [], 'data': {'choice.0.choice': , 'choice.0.votes': None, 'pub_date_date': '2007-08-15', 'choice.0.id': None, 'question': u'hey', 'id': 4L, 'pub_date_time': '15:55:09'}, 'original': <Poll: hey>}, 'title': u'Change poll'}]
func
<function include_admin_script at 0x01689370>
resolved_vars
[('/tiny_mce/tiny_mce.js', '/media/js/admin/textareas.js')]
self
<django.template.SimpleNode object at 0x01815950>
var
u'js'

  • c:\Python25\lib\site-packages\django\contrib\admin\templatetags\admin_modify.py in include_admin_script

26.

  1. {% include_admin_script "js/calendar.js" %} 28.
  2. could return:: 30.
  3. <script type="text/javascript" src="/media/admin/js/calendar.js">
  4. """
  5. if not absolute_url_re.match(script_path): ...
  6. script_path = '%s%s' % (settings.ADMIN_MEDIA_PREFIX, script_path)
  7. return u'<script type="text/javascript" src="%s"></script>' % script_path
  8. include_admin_script = register.simple_tag(include_admin_script) 37.
  9. def submit_row(context):
  10. opts = contextopts

▶ Local vars

Thanks for the help --> i have the newest and greatest django version on a windows box running xampp with apache 2.2.3

Change History (1)

comment:1 by Malcolm Tredinnick, 17 years ago

Resolution: invalid
Status: newclosed

Please ask support questions on the django-users mailing list.

This Trac is for bug reports only (and errors in wiki pages, since they can be edited by anybody, aren't typically classified as bugs). The mailing list should be able to give you some help, though, so please try there.

Note: See TracTickets for help on using tickets.
Back to Top