简体   繁体   English

如何在 django 应用程序中显示更多内容?

[英]How to show more content in django application?

I have developed template for viewing the group list in my django application.我开发了用于在我的 django 应用程序中查看组列表的模板。 What I came to know is that, after more groups, the page is scrolling down.我知道的是,在更多组之后,页面正在向下滚动。 I am unable to see all the names of the groups.我无法看到所有组的名称。 And also I want to view only 4 group names on the starting and then after clicking load more button, next 4 groups have to be shown.而且我想在开始时只查看 4 个组名,然后单击加载更多按钮后,必须显示接下来的 4 个组。 I am unable to do this.我无法做到这一点。

            <div class="container">
            {% for comment in comments %}
            <div id="com_div" class="comments-list">
            <div class="media">
            <img style="max-width: 30px" class="rounded-circle mr-2 mt-1" src="{{ 
             comment.user.profile.image.url }}">
            <div class="media-body">
            <small class="media-heading user_name my_style">{{ comment.user.username }}</small>
            <small class="bg-light rounded text-dark">{{ comment.date|naturaltime }}</small><br>
            <small style="font-size: 14px">{{ comment.content }}</small>
            <p>
              <small style="font-size: 13px">
                  <a data-toggle="collapse" href="#ReplyBox{{ comment.id }}" role="button" aria- 
                 expanded="false" aria-controls="ReplyBox{{ comment.id }}">
                     Reply</a>{% if comment.user == user %} - <a href="{% url 'del_comment' post.slug 
                comment.id %}">Delete</a>{% endif %}
              </small>
            </p>

This question is mostly related to Django, you have to paginate your list and you will have previous and next links.这个问题主要与 Django 有关,您必须对列表进行分页,并且您将拥有上一个和下一个链接。

Then using javascript you can navigate through them.然后使用 javascript 您可以浏览它们。

Django Pagination Docs Django 分页文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM