开发者

Django admin - importing images to the text

I've pasted below small part of my models class. It's a class for publishing entries (articles, blog posts etc.). On most we开发者_开发知识库bsites news images are pasted below the text of message.

Is it possible to add images directly inside the text while writing the entry/article?

Example:

Quisque aliquam magna pulvinar libero tincidunt auctor. Praesent nisi lacus, porta vel mattis sed, rhoncus ultrices risus. <<< Image 1 >>> Ut lobortis interdum nulla eget eleifend. Integer tincidunt accumsan vehicula. Nunc quis justo sit amet neque dapibus suscipit nec vitae felis. Proin pulvinar blandit enim, vel porta metus convallis non. <<< Image 2 >>> Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

class Publisher(models.Model):
   text = models.TextField()
   images = models.ManyToManyField('Images', blank=True)


One approach is to use TinyMCE or some other RTE + django-filebrowser to edit the HTML for the article plugging in images as you go. If you're looking for an automated solution that plugs in an image after so many paragraphs, you'd need to write that on your own.


An app that does pretty much what you are looking for is django-adminfiles.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜