1

I am trying to integrate django-tinymce with django-filebrowser for my django admin site. Everything (almost) works fine.

  • manage.py test filebrowser, works ok
  • http://localhost:8000/admin/filebrowser/browse/ works, too

however when I press the browse button on the windows popup of insert/edit image of tinymce button panel nothing happens.

in my firefox debug window I get an error like this (when pressing browse):

f is undefined
code: http://localhost:8000/static/js/tiny_mce/tiny_mce_src.js
line: 11981

and on my dev-server output window I get a 500 error like this:

GET /tinymce/filebrowser/ HTTP/1.1" 500 when admin page tries to load the tinymce_models.HTMLField() text area.

Any ideas what am I doing wrong?

PS: I also use grappelli and this is my settings.py part that loads the apps:

INSTALLED_APPS = (
#... usual django standard apps.. #
    'django.contrib.staticfiles',
    'grappelli',
    'filebrowser',
    'tinymce',
    'django.contrib.admin',
    'expedeat.dbadmin',
)
xpanta
  • 8,124
  • 15
  • 60
  • 104
  • offtopic: imho django-filebrowser realy sucks vs http://elrte.org/elfinder/demo – cetver Sep 25 '11 at 19:06
  • thanks. elFinder looks great. What I want though, is a simple file browser/uploader to work with tinyMCE editor. :-) – xpanta Sep 26 '11 at 04:55

1 Answers1

1

I finally managed to find the answer to my problem.

I had to modify the tinymce/views.py file like this:

fb_url = "%s://%s%s" % (request.is_secure() and 'https' or 'http',
    #request.get_host(), urlresolvers.reverse('filebrowser-index'))
    request.get_host(), urlresolvers.reverse('fb_browse'))

I found the answer in this post: http://www.mail-archive.com/django-users@googlegroups.com/msg100388.html

xpanta
  • 8,124
  • 15
  • 60
  • 104
  • I have your problem too and go to tinymce/views.py but I could find any line like you had and modified it , what's your idea ? – Alireza Sanaee Jun 23 '14 at 19:58
  • No idea other than version changes. Please, go in the tinymce directory and try `grep -r "fb_url" .` to find where the above line lies. – xpanta Jun 24 '14 at 09:50
  • I checked that but there wasn't any line like ```#request.get_host(), urlresolvers.reverse('filebrowser-index'))``` to modify it – Alireza Sanaee Jun 26 '14 at 17:29
  • It must be something with the versions. I know that this problem was resolved in the next iteration of tinymce. Do you have the latest versions of tinymce and filebrowser? What is the exact error message? – xpanta Jun 27 '14 at 08:24