search

Home  >  Q&A  >  body text

python - django做博客时候model里面是怎么做的?

初学编程,没有经验,请教大家。
我们平时写博客的时候,都是有所见即所得工具帮忙,然后将文章存进数据库。
我有如下疑问:

  1. 在django里怎么样,才可以使得写文章时可以使用所见即所得工具;
  2. 所见即所得是怎么与model结合的。我是指model关于这块该怎么写。因为写文章里肯定很多/n/n,还有加粗,引用一类的用法。
    想看一眼,看了应该就明白了。
    感谢
巴扎黑巴扎黑2767 days ago370

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-17 13:00:20

    I used a visual editor before http://rsj217.diandian.com/post/2013-09-14/40053589622
    Simple and hassle-free. But now the markdown visual editor seems to be more popular.

    To put it simply, model can provide a field to save labeled text. As for adding tags, leave it to the editor. The front desk will display it according to the needs.

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 13:00:20

    Here you need a rich text editor, which has nothing to do with Django's model. The model accepts plain text, and the editor and content rendering are both on the front end.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:00:20

    1. Model is only used to create objects that store data
    2. For label processing, you should use a rich text editor, such as TinyMCE
    3. Generally create a model object to save long text, and then save the data submitted through the rich text editor on the page into this object.

    reply
    0
  • Cancelreply