On Jun 24, 6:10 am, Dhruv Adhia <druf...@gmail.com> wrote:
> Hello All,
>
> I have following under models.py
>
> from django.db import models
> from django.contrib import admin
> from tinymce import models as tinymce_models
>
> class BlogPost(models.Model):
>
>     title = models.CharField(max_length=150)
>     body = models.TextField() #observe, thats how you get big
> character field
>     timestamp = models.DateTimeField()
>
>     class Meta:
>         ordering = ('-timestamp',)
>     class Admin:
>         list_display = ('title', 'timestamp')
>         js = ['tiny_mce/tiny_mce.js', 'js/textareas.js']
>
> class BlogPostAdmin(admin.ModelAdmin):
>     pass
>
> class MyModel(models.Model):
>     my_field = tinymce_models.HTMLField()
>
> admin.site.register(MyModel)
> admin.site.register(BlogPost, BlogPostAdmin)
>
> As you can see I have followed all the settings. But I dont get the
> editor for the textfield and also I HTMLfield does not work. Though I
> am able to edit content inside HTML field and then in the front end
> side I am not able to view it. It shows me all the tags.

I cannot comment about your problem with the BlogPost model, as you
are apparently setting up TinyMCE yourself. You may have to use
Firebug to debug Javascript.

As far as I can see, the MyModel HTMLField does exactly what it is
supposed to. You write that the admin site works, and stores HTML in
the field. You are seeing tags in your frontend (the raw HTML) because
the field content is not marked safe. You may want to use the 'safe'
filter. [1]

[1] http://docs.djangoproject.com/en/dev/ref/templates/builtins/#safe

Regards,

Joost
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to