因此,对于初学者,我在我的站点上使用django taggit作为标记系统。一切都很顺利,直到我决定尝试很长的弦和很多弦。结果是它从div中溢出。我想知道,每当发生这种情况时,如何使它转到div中的新行,或者甚至限制每个标记允许的最大字符数/限制允许的标记数
下面是相关的models.py
class Post(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=75)
text = models.TextField()
created_date = models.DateTimeField(default=timezone.now)
image = models.ImageField(upload_to='post_images',blank=True,null=True)
file = models.FileField(upload_to='post_files',blank=True,null=True)
published_date = models.DateTimeField(blank=True,null=True,auto_now_add=True)
comments_disabled = models.BooleanField(default=False)
NSFW = models.BooleanField(default=False)
spoiler = models.BooleanField(default=False)
tags = TaggableManager()
这是相关的HTML文件
{% for tag in post.tags.all %}
<li class="tag-list-box"><a class="tag-list-style" href="{% url 'mainapp:tagged' tag.slug %}">{{ tag.name }}</a></li>
{% empty %}
<li>No tags</li>
{% endfor %}
编辑:这是CSS
.tag-list-box {
white-space: pre-line;
}
那么,当标签开始从div溢出时,我该如何去断线,甚至如何限制允许的标签的实际数量呢
目前没有回答
相关问题 更多 >
编程相关推荐