Django admin - 将图像导入文本
我已经将我的模型类的一小部分粘贴在下面。这是一个用于发布条目(文章、博客文章等)的类。在大多数网站上,新闻图像都粘贴在消息文本下方。
撰写条目/文章时是否可以直接在文本中添加图像?
示例:
Quisque aliquam magna pulvinar libero Tincidunt auctor。 Praesent nisi lacus,porta vel mattis sed,rhoncus ultrices risus。 <强><<<图片1>>>> Ut lobortis interdum nulla eget eleifend。整数不可累积车辆。 Nunc quis justo sat amet neque dapibus suscipit nec vitae felis。 Proin pulvinar blandit enim,vel porta metus convallis non。 <强><<<图2>>>> 在我们的祖国、在希梅内奥斯的概念中,阶级是有默契的社会关系的。
class Publisher(models.Model):
text = models.TextField()
images = models.ManyToManyField('Images', blank=True)
I've pasted below small part of my models class. It's a class for publishing entries (articles, blog posts etc.). On most websites 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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种方法是使用 TinyMCE 或其他一些 RTE + django-filebrowser 来编辑文章的 HTML,并随时插入图像。如果您正在寻找一种在这么多段落后插入图像的自动化解决方案,那么您需要自己编写。
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.
django-adminfiles 是一款几乎可以满足您需求的应用程序。
An app that does pretty much what you are looking for is django-adminfiles.