django 文本从容器中出来,它只出现在一行中,并从页面中出来

jchrr9hc  于 2023-10-21  发布在  Go
关注(0)|答案(1)|浏览(108)

我正在尝试使用Django admin中的富文本上传字段向我的项目详细信息部分添加一些文本。它应该在一个段落中,因为我已经在我的Django管理项目描述中添加了它们,但它显示了一条线,并且它也离开了容器,但它在容器的左侧提供了空间,而不是在容器的右侧,它离开了页面。
以下是我的project-details.html页面:

{% extends "base.html" %}
{% load static %}
{% static "images" as baseUrl %}

{% block title %}{{projectdetails.title}}{% endblock %}

<!--header block -->
{% block header %}

<!-- Slider Start -->

<section class="section about">
    <div class="container">{{projectdetails.desc|safe}}</div>
        

</section>

<!--slider ends -->

<!-- footer Start -->

{% block footer %}

<!--Essential Scripts -->

{% block Scripts %}

{% endblock %}
{% endblock %}
{% endblock %}

以下是我的project.html页面:

{% extends "base.html" %}
{% load static %}
{% static "images" as baseUrl %}

{% block title %}Project{% endblock %}

<!--header block -->

{% block header %}
<!-- slider starts -->
</div>
<div class="typing">
    <p class="type4"></p>

</div>

<!-- section portfolio start -->
<section class="section box">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-lg-8">
                <div class="heading text-center">
                    <p>We have the best experts to elevate your business to the next level, try is and you will see! We have the best experts to elevate your </p>
                </div>
            </div>
        </div>
    </div>

    <div class="container">
        <div class="row ">
            {% for projects in projectdetails %}
            <div class="col-lg-4 col-md-6">
                <div class="portflio-item position-relative mb-4">
                    <a href="{% url 'project-details' id=projects.id %}" >
                        <img src="{{projects.img.url}}" alt="" class="img-fluid w-100">
                        <div class="overlay-item"><i class="ti-link"></i></div> 
                        
                        <div class="portfolio-item-content">
                            <h3 class="mb-0 text-white">{{projects.title}}</h3>
                            <p class="text-white-50">{{projects.category}}</p>
                        </div>
                    </a>
                </div>
            </div>
            {% endfor %}
        </div>
    </div>
</section>

<!--slider ends -->

<!-- footer Start -->
{% block footer %}

<!-- section portfolio END -->

{% endblock %}
{% endblock %}

以下是我的models.py部分:

class projectdetail(models.Model):
    title = models.CharField(max_length=100)
    desc = RichTextUploadingField(blank=True, null=True)
    category = models.ForeignKey(category, on_delete=models.CASCADE)
    client =models.CharField(max_length=100)
    startdate = models.DateTimeField(auto_now=False,auto_now_add=False)
    enddate = models.DateTimeField(auto_now=False,auto_now_add=False)
    img = models.ImageField(upload_to='pics')
    url = models.URLField(
        validators=[URLValidator(message="Enter a valid URL.")]
    )

现在我正面临着这个问题,如图所示。

我想在容器中正确地显示这些行,就像一个段落一样。

相关问题