将任意内容插入文本字段
我正在构建一个 CMS,我希望能够在文档(CMS 页面)的任意位置插入“内容”。
“stuff”对象将具有通用外键,可以是从数据库条目生成的表,也可以是上传的图像或其他东西。
我看到 Nathan Borror 的 django-basic-apps 包含 basic-inlines 应用程序看起来可能是一个很好的解决方案(基于 来自 django-mingus 的截屏),但我想确保没有其他选择我错过了。
非常感谢对替代解决方案的建议。
I'm building a CMS and I want to be able to insert "stuff" in arbitrary locations in a document (CMS page).
The "stuff" objects will have generic foreign keys and can be a table generated from a db entry, or it can be an uploaded image or something else.
I've seen that Nathan Borror's django-basic-apps contains a basic-inlines app which looks like it could be a good solution (based on the screencast from django-mingus), but I want to make sure that there aren't alternatives that I've missed.
Suggestions to alternative solutions are greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我对这个问题的解决方案可以追溯到上个世纪:-)。我为客户提供了任何对象的简单参考机制。具体来说:
其中
article.129
可以是任何 class.id 对。|
是可选的,其后面的文本也是可选的。如果存在,那就是链接文本,如果没有,我会执行object.title_for_link()
并使用它。这很容易与正则表达式匹配,并解决各种站点内引用问题。我通常会给他们一个特殊的页面,其中列出了所有 class.id 对及其获取的内容。他们将其放在单独的选项卡中,并在编辑时用作参考。顺便说一句,使用
.id
的原因是标题会改变,但id
不会。我正在开发一个新网站,我们使用 reStructured Text 作为主要输入格式。虽然它可以防止我的作者(他有华丽的排版倾向)失控,但我仍然必须扩展它以提供此类参考。对于图像等,有几种类似的参考机制,但其想法是让作者专注于内容制作,并尽可能远离担心正确的 HTML 标记。
My solution to this problem dates back to the last century :-). I give my customers a simple reference mechanism to any object. Specifically:
Where
article.129
can be any class.id pair. The|
is optional as is the text after it. If it's there, that's the link text, if not I doobject.title_for_link()
and use that. This is easy stuff to match with regexp and solves all sorts of intra-site referencing problems. I normally give them a special page that lists all class.id pairs along with what it gets them. They bring it up in a separate tab and use it for reference while editing.BTW, the reason for using the
.id
is because titles change, butid
s don't.I am working on a new site where we are using reStructured Text as the primary input format. Although it works OK to keep my author (who has a tendency for flamboyant typography) from getting out of control, I still had to extend it to make this type of reference available. There are several similar reference mechanisms for images, etc., but the idea is to keep the author focused on content production and as far away as possible from worrying about proper HTML markup.