Re: About using django-tinymce

2009-09-22 Thread Joost Cassee

On 22 sep, 08:17, taijirobot  wrote:
> well, guys, I've solved this problem, but in a bad way.
>
> Since I'm running the site locally with the default django server, the
> MEDIA_URL became a confusing thing to me. Luckily I have an Apache
> server running on my machine, so I just set the MEDIA_URL to 'http://
> localhost/media/' and copied the files needed in to it.
>
> I think it's a bad way, even no way worse. But it works :)

Check out [1] for more tips on serving static media.

[1] http://docs.djangoproject.com/en/dev/howto/static-files/


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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-22 Thread Daniel Roseman

On Sep 22, 7:17 am, taijirobot  wrote:
> well, guys, I've solved this problem, but in a bad way.
>
> Since I'm running the site locally with the default django server, the
> MEDIA_URL became a confusing thing to me. Luckily I have an Apache
> server running on my machine, so I just set the MEDIA_URL to 'http://
> localhost/media/' and copied the files needed in to it.
>
> I think it's a bad way, even no way worse. But it works :)
>

I don't know why you think this is a bad way to do it. It's a
perfectly good method. Django doesn't usually serve your media for
you, although it can be made to do it via the development server only,
so using Apache is the normal way to do it.
--
DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-22 Thread Daniel Roseman

On 2009/9/22, taijirobot  wrote:

> Thank you very much. The problem was solved after I changed the
> MEDIA_URL setting.
>
> But now I have a new question, it is about the display of the rich
> text.
>
> I used code like this to display it:
>
> {{ post.title }}
> {{ post.timestamp|date }}
> {{ post.body }}
>
> the body was edited in rich text editor. as you know, the body will be
> displayed in html format with html tags with it, but not a formatted
> text.
>
> What should I do to display the body as it edited?
>
> Thank you.

Look at the documentation on autoescaping:
http://docs.djangoproject.com/en/dev/topics/templates/#id2
--
DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-22 Thread taijirobot

well, guys, I've solved this problem, but in a bad way.

Since I'm running the site locally with the default django server, the
MEDIA_URL became a confusing thing to me. Luckily I have an Apache
server running on my machine, so I just set the MEDIA_URL to 'http://
localhost/media/' and copied the files needed in to it.

I think it's a bad way, even no way worse. But it works :)

On Sep 21, 12:22 pm, taijirobot  wrote:
> Hi, guys,
>
> I'm learning django recently and I am trying to add a rich text editor
> to the places where long formated text like blog post are needed (the
> site is running on local machine with the default django server).
>
> I tried to use django-tinymce :http://code.google.com/p/django-tinymce/
> and all the things I did was:
>
> 1. download the django-tinymce package, extract, and run 'sudo python
> setup.py install'
>
> 2. get a tinymce distribution(new enough) and copy the jscripts/
> tiny_mce to the media root of my local machine.
>
> my config:
> MEDIA_ROOT = '/home/taijirobot/mysite/media/'
> MEDIA_URL = ''
>
> 3. add 'tinymce' to INSTALLED_APPS in settings
>
> 4. Change the definition of the BlogForm (a form defined to generate
> form for blog mode), like this:
> ..
> class BlogPost(models.Model):
>     title = models.CharField(max_length=150)
>     body = models.TextField()
>     timestamp = models.DateTimeField(default=datetime.datetime.now)
>     class Meta:
>         ordering = ('-timestamp',)
> ..
> class BlogForm(ModelForm):
>     body = forms.CharField(widget=TinyMCE(attrs={'cols':80, 'rows':
> 30}))
>     class Meta:
>         model = BlogPost
>         exclude = ['timestamp']
> ..
>
> The document says we can get a tinymce editor in the admin site after
> this. But nothing different shows with mine.
>
> What might be the problem?
> Is it because the wrong MEDIA_URL setting? Or I've missed something
> when installing or using?
>
> Thank you.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-21 Thread Rama Vadakattu

[Off topic suggesting another rich text powerful editor]
You can also try  django CK editor
1) which is easy to user
2) which is powerful,fast and more robust than TInyMCE
http://code.google.com/p/django-ck/
3) with every ease you can also integrate directly.

On Sep 22, 6:45 am, taijirobot  wrote:
> thank you, I missed the line 'form = BlogForm' in admin class, but
> after I added this, the tinymce editor still doesn't show, except that
> the body textarea is bigger than it used to be.
>
> On Sep 22, 1:42 am, brad  wrote:
>
> > > The document says we can get a tinymce editor in the admin site after
> > > this. But nothing different shows with mine.
>
> > Just to clarify, are you trying to get tinymce displaying in your
> > django admin?  If so, you have to tell the admin for your BlogPost
> > model to use the BlogForm.  So do you have an admin.py with something
> > like the following?
>
> > class BlogPostAdmin(ModelAdmin):
> >     form = BlogForm
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-21 Thread taijirobot

thank you, I missed the line 'form = BlogForm' in admin class, but
after I added this, the tinymce editor still doesn't show, except that
the body textarea is bigger than it used to be.

On Sep 22, 1:42 am, brad  wrote:
> > The document says we can get a tinymce editor in the admin site after
> > this. But nothing different shows with mine.
>
> Just to clarify, are you trying to get tinymce displaying in your
> django admin?  If so, you have to tell the admin for your BlogPost
> model to use the BlogForm.  So do you have an admin.py with something
> like the following?
>
> class BlogPostAdmin(ModelAdmin):
>     form = BlogForm
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-21 Thread taijirobot

Yes, I am very unconfident about my MEDIA_URL settings too. But I
don't know how to set it in my case that I am running the site on the
localhost.

On Sep 21, 4:37 pm, Daniel Roseman  wrote:
>
> Well, I would assume that MEDIA_URL is wrong - it's very unlikely you
> want it to be blank. But more to the point, what is serving the media
> and what URL is it serving it on? That's the value you should use for
> MEDIA_URL.
> --
> DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-21 Thread brad

> The document says we can get a tinymce editor in the admin site after
> this. But nothing different shows with mine.

Just to clarify, are you trying to get tinymce displaying in your
django admin?  If so, you have to tell the admin for your BlogPost
model to use the BlogForm.  So do you have an admin.py with something
like the following?

class BlogPostAdmin(ModelAdmin):
form = BlogForm


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-21 Thread Joost Cassee

On 21 sep, 06:22, taijirobot  wrote:

> What might be the problem?

If it still doesn't work after following Daniel's suggestion, you
might try debugging using Firebug. Problems like this are usually
because the Javascript is not loaded.

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
-~--~~~~--~~--~--~---



Re: About using django-tinymce

2009-09-21 Thread Daniel Roseman

On Sep 21, 5:22 am, taijirobot  wrote:
> Hi, guys,
>
> I'm learning django recently and I am trying to add a rich text editor
> to the places where long formated text like blog post are needed (the
> site is running on local machine with the default django server).
>
> I tried to use django-tinymce :http://code.google.com/p/django-tinymce/
> and all the things I did was:
>
> 1. download the django-tinymce package, extract, and run 'sudo python
> setup.py install'
>
> 2. get a tinymce distribution(new enough) and copy the jscripts/
> tiny_mce to the media root of my local machine.
>
> my config:
> MEDIA_ROOT = '/home/taijirobot/mysite/media/'
> MEDIA_URL = ''
>
> 3. add 'tinymce' to INSTALLED_APPS in settings
>
> 4. Change the definition of the BlogForm (a form defined to generate
> form for blog mode), like this:
> ..
> class BlogPost(models.Model):
>     title = models.CharField(max_length=150)
>     body = models.TextField()
>     timestamp = models.DateTimeField(default=datetime.datetime.now)
>     class Meta:
>         ordering = ('-timestamp',)
> ..
> class BlogForm(ModelForm):
>     body = forms.CharField(widget=TinyMCE(attrs={'cols':80, 'rows':
> 30}))
>     class Meta:
>         model = BlogPost
>         exclude = ['timestamp']
> ..
>
> The document says we can get a tinymce editor in the admin site after
> this. But nothing different shows with mine.
>
> What might be the problem?
> Is it because the wrong MEDIA_URL setting? Or I've missed something
> when installing or using?
>
> Thank you.

Well, I would assume that MEDIA_URL is wrong - it's very unlikely you
want it to be blank. But more to the point, what is serving the media
and what URL is it serving it on? That's the value you should use for
MEDIA_URL.
--
DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---