开发者

Django admin - importing images to the text

开发者 https://www.devze.com 2023-04-04 22:34 出处:网络
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.

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

精彩评论

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