Monday, October 29, 2012

Re: django + tinymce problems

Thanks for the reply Tom.

It worked after changing to relative paths.

Sreekanth

On Monday, 29 October 2012 11:13:17 UTC, Tom Evans wrote:
On Sun, Oct 28, 2012 at 9:44 PM, sri <devanas...@gmail.com> wrote:
> Hi,
>
> I have tried using tinymce in my sample django application, but i am not
> getting the tinymce editor in my admin pages.
>
> I am trying to setup tinymce to use in admin pages and using Django 1.4
>
> This is how my settings.py file looks like
>
>    MEDIA_ROOT = ' '
>    MEDIA_URL = ' '
>    STATIC_ROOT = ' '
>    STATIC_URL = '/static/'
>    TINYMCE_JS_URL = os.path.join(PROJECT_ROOT,
> "static/js/tiny_mce/tiny_mce.js")
>    TINYMCE_DEFAULT_CONFIG = {
>        'plugins': "table,spellchecker,paste,searchreplace",
>        'theme': "advanced",
>        'cleanup_on_startup': True,
>        'custom_undo_redo_levels': 10,
>    }
>    TINYMCE_SPELLCHECKER = True
>    TINYMCE_COMPRESSOR = True
>
>
> And in my app, the models.py file looks like below
>
>     class place(models.Model):
>         place_description = models.TextField(max_length=5000)
>
> And my admin.py field looks like below:
>
>     class PlaceDetailsAdmin(admin.ModelAdmin):
>                 class Media:
>                        js =
> ('/Users/Sreekanth/django_demo/godjango/sample/sample/static/js/tiny_mce/tiny_mce.js',
>
> '/Users/Sreekanth/django_demo/godjango/sample/sample/static/js/textareas.js'
>                        )

Paths in the Media class should be relative to your static URL, not
absolute file locations.

https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#modeladmin-media-definitions
https://docs.djangoproject.com/en/1.4/topics/forms/media/#form-media-paths

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/QNeeuMz6MRYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment