jazzband / django-tinymce Goto Github PK
View Code? Open in Web Editor NEWTinyMCE integration for Django
Home Page: http://django-tinymce.readthedocs.org/
License: MIT License
TinyMCE integration for Django
Home Page: http://django-tinymce.readthedocs.org/
License: MIT License
when I install 1.5 via pip I get an older version of the code, which raises an import error when trying to import the widget.
Im having this error lately, I guess django version related, any suggestions?
from django.conf.urls.defaults import *
ImportError: No module named defaults
I have a problem with the collectstatic command when enabling this setting:
'STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage':
ValueError: The file 'tiny_mce/plugins/fullpage/images/add.gif' could not be found with <django.contrib.staticfiles.storage.CachedStaticFilesStorage object at 0x103b7090>.
How I cat fix this?
I have this markup in my database:
<p>hello </p>
// Notice there's a space after hello
The widget gets rendered as:
<textarea><p>hello </p></textarea>
Which results in the browser deleting spaces at the end.
This happens because on line 82 of tinymce/widgets.py the code uses Django's builtin escape function to escape html within the content of my database attribute. The solution is to replace that call with a call to the following function, that replaces all spaces for &nsbp; chars.
def html_escape(text):
return escape(text).replace(' ', ' ')
Hello,
Can you help me with this issue?
TinyMCE always stripping away my classes and inline style
even if I've tried these:
'inline_styles' : True,
'verify_html' : False,
'cleanup_on_startup': False,
Thanks
When I tryes to save my model the textareas with tiny-mce enabled dont save any.
I've tried model's widget, HTML field - both dont work.
But when I include tiny-mce js fife for texatareas it works.
Also, when I install django-filebrowser with tiny-mce included as js file - django-filebrowser don't work.
My envirement: django 1.4a, django-tinymce from this repo, django-filebrowser-no-grapelly-django13
.root seems to be wrong?
I've been struggling to find a reason why these two buttons will just not show up.
TINYMCE_DEFAULT_CONFIG includes textcolor in the plugins, forecolor,backcolor in theme_advanced_buttons1
I noticed that textcolor isn't in the plugins dir of this package, so I added it, but that didn't change anything.
I might be using files from TinyMCE 4, I downloaded the newest version before I realized the TinyMCE files were included in the app, and I've been adding files to that static dir whenever it seemed like I was missing a file. When I remove the static files dir tiny_mce, it definitely breaks my TinyMCE. That folder has tinymce.min.js and a themes dir.
If it helps, I also don't set the TINYMCE_SPELLCHECKER or TINYMCE_COMPRESSOR because when either is true, TinyMCE editor will not display. When it's removed, it works fine.
Other than these two missing buttons, I've really appreciated this app.
Thanks,
The documentation should be updated to reflect the fact that you can set up without having to add tinymce to installed apps and it works fine.Please correct me if i'm wrong.
Following the instructions at http://django-tinymce.readthedocs.org/en/latest/installation.html#testing consistently fails for me (Python 2.7.2 on OSX 10.8.5).
Virtualenv setup seems fine:
bos-mp9us:tmp brsmith$ mkdir mcetest
bos-mp9us:tmp brsmith$ cd mcetest/
host:mcetest user$ virtualenv --no-site-packages env
New python executable in env/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
host:mcetest user$ . env/bin/activate
(env)host:mcetest user$
pip produces some warnings, but everything seems to install OK:
(env)host:mcetest user$ pip install Django django-staticfiles django-tinymce
Downloading/unpacking Django
Downloading Django-1.5.4.tar.gz (8.1MB): 8.1MB downloaded
Running setup.py egg_info for package Django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
Downloading/unpacking django-staticfiles
Downloading django-staticfiles-1.2.1.tar.gz (42kB): 42kB downloaded
Running setup.py egg_info for package django-staticfiles
warning: no previously-included files matching '*.pyc' found anywhere in distribution
Downloading/unpacking django-tinymce
Downloading django-tinymce-1.5.1.tar.gz (2.4MB): 2.4MB downloaded
Running setup.py egg_info for package django-tinymce
warning: no previously-included files found matching '*.pyc'
Downloading/unpacking django-appconf>=0.4 (from django-staticfiles)
Downloading django-appconf-0.6.tar.gz
Running setup.py egg_info for package django-appconf
Downloading/unpacking six (from django-appconf>=0.4->django-staticfiles)
Downloading six-1.4.1.tar.gz
Running setup.py egg_info for package six
Installing collected packages: Django, django-staticfiles, django-tinymce, django-appconf, six
Running setup.py install for Django
changing mode of build/scripts-2.7/django-admin.py from 644 to 755
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
changing mode of /Users/brsmith/tmp/mcetest/env/bin/django-admin.py to 755
Running setup.py install for django-staticfiles
warning: no previously-included files matching '*.pyc' found anywhere in distribution
Running setup.py install for django-tinymce
warning: no previously-included files found matching '*.pyc'
Running setup.py install for django-appconf
Running setup.py install for six
Successfully installed Django django-staticfiles django-tinymce django-appconf six
Cleaning up...
(env)host:mcetest user$ ls env/lib/python2.7/site-packages/
Django-1.5.4-py2.7.egg-info pkg_resources.py
_markerlib pkg_resources.pyc
appconf setuptools
django setuptools-0.9.8-py2.7.egg-info
django_appconf-0.6-py2.7.egg-info six-1.4.1-py2.7.egg-info
django_staticfiles-1.2.1-py2.7.egg-info six.py
django_tinymce-1.5.1-py2.7.egg-info six.pyc
easy_install.py staticfiles
easy_install.pyc testtinymce
pip tinymce
pip-1.4.1-py2.7.egg-info
(env)host:mcetest user$
...but django-admin can't find testtinymce.staticfile_settings:
(env)host:mcetest user$ export DJANGO_SETTINGS_MODULE='testtinymce.staticfiles_settings'
(env)host:mcetest user$ django-admin.py syncdb
Traceback (most recent call last):
File "/Users/brsmith/tmp/mcetest/env/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/Users/brsmith/tmp/mcetest/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/Users/brsmith/tmp/mcetest/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/brsmith/tmp/mcetest/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/Users/brsmith/tmp/mcetest/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/Users/brsmith/tmp/mcetest/env/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/Users/brsmith/tmp/mcetest/env/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/Users/brsmith/tmp/mcetest/env/lib/python2.7/site-packages/django/conf/__init__.py", line 134, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'testtinymce.staticfiles_settings' (Is it on sys.path?): No module named staticfiles_settings
(env)host:mcetest user$
I can't find any evidence of it either:
(env)host:mcetest user$ find . -iname '*staticfiles_settings*'
(env)host:mcetest user$ grep -r staticfiles_settings .
(env)host:mcetest user$
I haven't used virtualenv before, so if it's not a code problem then perhaps there are some assumptions in the instructions that I'm missing?
check http://code.google.com/p/django-tinymce/issues/detail?id=41 if still valid
Hello there,
I just encountered an issue with unicode and django-tinymce.
Basically what happened is that I have a language name that use unicode character without being u
prefixed.
I know this is totally on me but still, django-tinymce broke silently without displaying anything in the view.
I had to step debug to find out where the problem was.
I think it would be nice to either add a note about it in the doc or maybe do something in the code to help report this error. I think it would be better that the app just crash and report the problem instead of dying silently.
Btw the line the error occured there --> https://github.com/aljosa/django-tinymce/blob/master/tinymce/widgets.py#L125
Thanks for the great app anyway, it helps a lot !
The first time I enabled it displayed a "CSRF verification failed" error (http://pastie.org/2220463). If we decorate the view with @csrf_exempt the error goes away but I am not sure if there is way to make tinymce work nicely with django csrf checks enabled.
Any ideas?
hey, django-tinymce developers,
I'm trying to get django-tinymce into fedora [1], according to the
fedora packaging guidelines [2], these binary files are not permitted:
$ find . -type f -name "*.swf"
./tinymce/static/tiny_mce/plugins/media/moxieplayer.swf
./tinymce/media/tiny_mce/plugins/media/moxieplayer.swf
My question is, are there any potential risks after removing those binaries
from source?
To clarify, I'm not intending to remove those files from upstream source.
I'd like to know whether removing them would break the main features.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1000263
[2] https://fedoraproject.org/wiki/Packaging:Guidelines#No_inclusion_of_pre-built_binaries_or_libraries
Hi,
I installed django-tinymce and django-filebrowser. I also downloaded tinymce 4.0.11 and 3.5.10. I extracted them in my static directory and configured settings.py and urls.py. I noticed that djang-tinymce works with tinymce 4.x but not with 3.5.x for some unknown reason. And by "work" I mean that HTMLField shows in my admin panel.
Another problem is that I can't see the filebrowser button. This is my settings:
(notice that tinymce35 is tinymce version 3.5 and tinymce is version 4.x. Former doensn't work, latter does. I don't know why. I also changed theme to 'advanced' when using tinymce 3.5. and checked that http://localhost:8000/static/tinymce35/tiny_mce_src.js is OK)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
)
TINYMCE_JS_URL = os.path.join(STATIC_URL, "tinymce/tinymce.min.js")
TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, "tinymce/")
TINYMCE_DEFAULT_CONFIG = {
'plugins': "table,paste,searchreplace",
'theme': "modern",
'skin': 'lightgray',
'cleanup_on_startup': True,
'custom_undo_redo_levels': 10,
'entity_encoding': 'raw',
}
TINYMCE_SPELLCHECKER = False
TINYMCE_FILEBROWSER = True
Any ideas?
OS: Using django 1.5.5 and latest versions of django-tinymce and django-filebrowser. I also use django-grappelli 2.4.8
Original ticket here: http://code.google.com/p/django-tinymce/issues/detail?id=89
What steps will reproduce the problem?
from tinymce import models as tinymce_models
class A(models.Model):
/* put some fields there, or not */
class B(models.Model):
text = tinymce_models.HTMLField()
a = models.ForeignKey(A, related_name='bs')
classBInline(admin.StackedInline):
model = models.B
fields = ['text']
class AAdmin(admin.ModelAdmin):
inlines = [BInline]
Will be good if you update TinyMCE libraries to version 3.4.7 since they solve an IE8 bug and more fixes
yours is at https://github.com/aljosa/django-tinymce/tree/master/tinymce/static/tiny_mce
django-tinymce works fine in admin page,
but for some reason when my form is posted to a non-admin view it becomes invalid.
below is my model, form, view, and template.
models.py
class Column(models.Model):
title = models.CharField(max_length=128)
column_body = models.TextField()
def __unicode__(self):
return self.title
forms.py
class ColumnForm(forms.Form):
body = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
views.py
def column_form(request):
if request.method == 'POST':
form = ColumnForm(request.POST)
if form.is_valid():
body = form.cleaned_data['body']
column = Column.objects.create(
title = 'test',
column_body = body,
)
return HttpResponseRedirect('/society/column/test/')
return HttpResponse('invalid')
variables = RequestContext(request, {
'form': ColumnForm(),
})
return render_to_response('column_form.html', variables, context_instance=RequestContext(request))
column_form.html
...
<script type="text/javascript" src="/static/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="/static/js/tiny_mce/textarea.js"></script>
<div id="content" class="cf">
<form id="column_form" method="post" action="." enctype="multipart/form-data">
{% csrf_token %}
{% for field in form %}
<div class="fieldWrapper">
{{ field.errors }}
{#{{ field.label_tag }}: #}{{ field }}
</div>
{% endfor %}
<p><input type="submit" value="칼럼 입력" /></p>
</form>
</div>
...
Hi,
When I use the widget in the django admin, i cannot set 'cols', if use fieldsets and 'classes': ['collapse'].
Supose I have a tinymce charfield, and the put this into an admin fieldset
class FlatPageForm(forms.ModelForm):
...
content = forms.CharField(widget=TinyMCE(attrs={'cols': 120, 'rows': 30}))
...
class FlatAdmin(ModelAdmin):
fieldsets = [
...
('Foo', {'fields': ['content',],'classes': ['collapse']}),
...
]
Then, the result is not seen properly the widget with 120 cols!
Thanks!,
Mario.
These files should be encoded in UTF-8:
- https://github.com/aljosa/django-tinymce/blob/master/tinymce/static/tiny_mce/plugins/spellchecker/editor_plugin_src.js#L170
replace TINYMCE_USE_FILEBROWSER w/ generic filebrowser handler
Dear all,
I've updated Django and found a bug:
tinymce.urls:4
from django.conf.urls.defaults import *
should be changed to
from django.conf.urls import url, patterns
in Django 1.6
Thank you, best regards, Raphael.
I need to save the caret (editing position) from save/submit... the caret going back to the top loses where the user was editing...
does django-tinymce have a way to do this?
My languages setting is set to en-us. The tinymce widget strips this down to just "en". This makes words like "centralized" appear as misspelled.
What's the rational for the TINYMCE_DEFAULT_CONFIG deprecation made in e5ef10b?
Hi,
So I'm trying to add the spellchecker plugin to a custom model form and its not appearing. I've followed the docs and have the following in my settings.py:
TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'theme_advanced_buttons1': "bold,italic,underline,link,unlink,bullist,blockquote,spellchecker,undo",
'theme_advanced_buttons2': "",
'theme_advanced_buttons3': "",
}
TINYMCE_SPELLCHECKER = True
My model form has the following:
class CustomForm(ModelForm):
allow_custom_image_upload = True
class Meta:
model = Foo
widgets = {
'body': tinymce_widgets.TinyMCE,
}
It renders all the other buttons, even skipping over the spellchecker and displaying the undo button.
Has anyone seen this before? I'm running the most recent version as per PIP, running on django 1.4.3
is it possible to change compressor url to /compressor/some-cache-code/?
I ran into a difficulty busting the cache when compressor is enabled with a custom plugin.
Found a bug in a plugin affecting IE, now can't deploy the fix because of very sticky cache.
Thank you.
I'm kind of a Django newbie, only on my third project and I'm wondering if I should venture down the path of using django-tinymce or wait for it to be updated at some point.
Thanks,
Dave
Hi,
When I use tinymce, I want to have the urls of images like: /static/images/example.png when I save the form.
I've tried all solutions on:
http://www.tinymce.com/wiki.php/TinyMCE_FAQ#Paths.2FURLs_are_incorrect.2C_I_want_absolute.2Frelative_URLs.3F
and:
http://www.tinymce.com/tryit/url_conversion.php
I have only two possible results:
Even with 'convert_urls' : 'false', I've a conversion when I set /static/images/example.png.
I use the latest version of django-tinymce, with chromium.
Do you have an idea to fix the problem ?
Thanks for your answer.
After more or less 2 days to try to debug this problem. the problem is that in the admin, the HTMLField isn't displayed. it's blank.
So I came to debug on the shell and I found this error :
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)
home/david/src/atmosphere/venv/local/lib/python2.7/site-packages/tinymce/widgets.pyc in get_language_config(content_language)
153 for lang, name in settings.LANGUAGES:
154 if lang[:2] not in lang_names: lang_names[lang[:2]] = []
--> 155 lang_names[lang[:2]].append(_(name))
156 sp_langs = []
157 for lang, names in lang_names.items():
and after it's django stacktrace.
Have you already faces this problem ? Have you some advice to correct it ?
Thanks you in advance
When activating COMPRESSOR, I get tinyMCE is not defined. if I try tinyMCE_GZ.init I get tinymce is not defined.
In a model, I define one HTMLField and more TextFields, and it all going well.
But when defined more HTMLFields in one model, trouble arised. That's, on the same "mode" in tinymce 3.X, such as "textareas", TinyMCE.init is rendered repeatedly! It should not be! it is the result that I can't resize the size of HTMLField through draging.
Is it Python 3 compatible?
The manual ha links to http://wiki.moxiecode.com/index.php/TinyMCE:Configuration and to http://wiki.moxiecode.com/index.php/TinyMCE:Custom_filebrowser ; both are down now
I think the links should point to http://www.tinymce.com/wiki.php/configuration and http://www.tinymce.com/wiki.php/TinyMCE3x:How-to_implement_a_custom_file_browser
Hello,
Can anyone give me a hint how to configure django-tinymce with django-filebrowser?
I am struggeling with the different configuration settings in my settings.py. Is there anywhere a good documentation?
Thanks in advance
Hi,
Has anyone attempted to integrate the latest TinyMCE build into django-tinymce? I've currently been giving it a go, but the settings for relative_urls seem to be ignored, and my URLs are not building correctly.
If anyone else is working on this, maybe we can work together to get this up and running? Or are there plans to upgrade at a later time?
Thanks!
I am having an issue where the Image upload pop up and other pop up pages are not rendering, this is due to them being served from the static file, can I configure them some how so this is not the case?
Thanks,
Cory
If I set USE_I18N = True
in my settings.py, all TinyMCE widgets vanish. Looking at my page source, the TinyMCE widget isn't rendering any markup.
As of now the documentation in http://readthedocs.org/docs/django-tinymce/en/latest/ which I suppose is the latest available need some fix.
installation.html#testing item 2 is better has the version numbers.
pip install Django django-staticfiles django-tinymce
Above what the documentation says, by today installs django version 1.4, which the testapp is not compatible with, but the issue is it is not also compatible with version 1.3, especially filebrowser and staticfiles are problematic. So I believe a fix like below would save some time for the next visitors who wants to test the installation.
pip install Django==1.x django-staticfiles==y django-tinymce==1.5.1b2
I can give more feedback if you need.
When I set TINYMCE_COMPRESSOR = True, popup windows (like html editor, link insertion) are not loaded properly. They appear empty. In the popup source I can see html of the template used for loading it, but the script which should substitute the values into html template is not run (I see no error messages in either parent or popup window). This indicates that popup initialization script was somehow corrupted during compression. It's not the first time I face this problem, starting from scratch.
I installed django-tinymce with pip, as suggested, so I have version 1.5.1b4
I'm using Django 1.5.
My settings.py contains:
INSTALLED_APPS = (
[omissis]
'django.contrib.staticfiles',
'tinymce',
)
TINYMCE_JS_URL = os.path.join(STATIC_URL, "tiny_mce/tiny_mce_src.js")
TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, "tiny_mce")
TINYMCE_DEFAULT_CONFIG = {
'cleanup_on_startup': True,
'custom_undo_redo_levels':20,
}
My urls.py includes
url(r'^tinymce/', include('tinymce.urls')),
If i leave the
TINYMCE_COMPRESSOR = True commented out, it works and I see the WYSIWYG tool, if I uncomment it, there is a simple textbox.
I modified templates/tinymce/tiny_mce_gzip.js adding {% load url from future %} and
modified {% url tinimce-compressor %}
to {% url "tinimce-compressor" %}
otherwise Django was complaining that it
"Could not parse the remainder: '-compressor' from 'tinymce-compressor'."
Dear all,
I'm using tatest pypi version of django-tinymce with django 1.4.8 and apache2 as a production enviroment and sometimes I have a problem.
Sometimes, on production, all of the application TinyMCE fields are shown as read only fields. I use multiple browsers, and I see the problem on all.
When I restart the Apache server, the problem dissapears itself. After some time, it appears again.
I cannot replicate the problem on my development enviroment.
I have checked that the javascript output is the same as expected.
Using Firebug, the only difference that I have seen on the page render is the following:
Bad, read only version:
<body id="tinymce" class="mceContentBody " onload="window.parent.tinyMCE.get('id_foro-descripcionhtml').onLoad.dispatch();" spellcheck="false" dir="ltr">
Good version:
<body id="tinymce" class="mceContentBody " contenteditable="true" onload="window.parent.tinyMCE.get('id_foro-descripcionhtml').onLoad.dispatch();" spellcheck="false" dir="ltr">
The difference is that the good version has the contenteditable="true" atribute.
What could be the problem? May it be a "race condition" on TinyMCE javascript load? Or some Apache multithreading problem?
Thank you, best regards,
Hi
django tiny-mce version: 1.5.1b2
django-filebrowser: 3.4.0
What happens:
When I try to add image to text, image popup opens properly, filebrowser works, selecting image in filebrowser works - image url is properly pasted to Image URL filed on Insert/edit image dialog. However when I click Insert I dont see image in text. Checking generated source shows empty img tag
Expected behavior:
Properly embeded image in text
I used instruction from https://github.com/aljosa/django-tinymce/blob/master/docs/installation.rst to test django-tinymce.
Environment:
Request Method: GET
Request URL: http://localhost:8000/admin/testapp/testpage/add/
Django Version: 1.3.1
Python Version: 2.6.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.flatpages',
'tinymce',
'testtinymce.testapp',
'filebrowser',
'filebrowser',
'staticfiles']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')
Traceback:
File "/Users/cccccaaa/Desktop/env/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
request.path_info)
for pattern in self.url_patterns:
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
self._urlconf_module = import_module(self.urlconf_name)
**import**(name)
url(r'^admin/(.*)', admin.site.root),
Exception Type: AttributeError at /admin/testapp/testpage/add/
Exception Value: 'AdminSite' object has no attribute 'root'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.