1
我已經安裝了應用程序TinyMCE,並且所有程序都已啓動並正在運行。但有一個問題。發佈帶有圖像的HTML輸入時以純文本顯示。沒有HTML輸出到Django的博客文章
<p><img src="https://www.djangoproject.com/s/img/logos/django-logo-negative.png" alt="django" /></p> <p>Lorem ipsum dolor sit amet, inani clita efficiantur sed et, ad honestatis complectitur vim.</p>
的index.html:
{% for post in posts %}
<div class="post">
<h2>{{ post.title }}</h2>
<p>Posted on {{ post.timestamp }} by {{ post.author }}</p>
<p>{{ post.bodytext }}</p>
</div>
{% endfor %}
models.py:
from django.db import models
from django.utils import timezone
from django.conf import settings
from tinymce.models import HTMLField
class posts(models.Model):
author = models.CharField(max_length = 30)
title = models.CharField(max_length = 100)
bodytext = HTMLField()
timestamp = models.DateTimeField(default = timezone.now) # sets a default date & time value when creating a new post
class Meta:
verbose_name_plural = "posts" # sets the plural name of posts (default = postss)
def __str__(self):
return self.title
我想有件事情我甲肝被遺忘了。那麼這裏有什麼問題?
你,先生,值得一啤酒!非常感謝。 – Qao
沒問題的隊友!我們都有這個問題 – user1797792