How do I implement markdown in Django 1.6 app?

前端 未结 3 1598
滥情空心
滥情空心 2020-12-25 14:58

I have a text field in models.py where I can input text content for a blog using the admin.

I want to be able to write the content for this text field i

3条回答
  •  猫巷女王i
    2020-12-25 15:23

    Thank you for your answers and suggestions, but I've decided to use markdown-deux.

    Here's how I did it:

    pip install django-markdown-deux

    Then I did pip freeze > requirements.txt to make sure that my requirements file was updated.

    Then I added 'markdown_deux' to the list of INSTALLED_APPS:

    INSTALLED_APPS = (
        ...
        'markdown_deux',
        ...
    )
    

    Then I changed my template index.html to:

    {% load markdown_deux_tags %}
    
    
        
            My Django Blog
        
        
            {% for post in post %}
            

    {{ post.title }}

    {{ post.pub_date }}

    {{ post.text|markdown }} {{ post.tags }} {% endfor %}

提交回复
热议问题