enter image description here
这是我的html代码,我想过滤器只显示一个时间为每个用户,我已经改变了我的 www.example.com 来到
allexpelorer =目的地。objects.filter(destination = pk)。order_by('- pk ')
{% if allexpelorer %}
{% for allexpelorer in allexpelorer%}
<div class="col-md-3 mt-2" style="background-color: #ffffff;border: 10px solid #f7f7f7;">
<div class="row">
<div class="col-12 p-0">
{% for allusersinfo in allusersinfo %}
{% if allusersinfo.user_pk == allexpelorer.user_pk %}
{% if allusersinfo.profilecover %}
<img src="{{allusersinfo.profilecover}}" style="height: 80px; width: 100%;">
{% else %}
<img src="{% static 'front/assets/img/cover.png' %}" style="height: 80px; width: 100%;">
{% endif %}
{% endif %}
{% endfor %}
</div>
<div class="row ml-1" style="margin-top: -26px;">
<div class="col-2">
{% for allusersinfo in allusersinfo %}
{% if allusersinfo.user_pk == allexpelorer.user_pk %}
{% if allusersinfo.profileimg %}
<img class="img-cls-circle" src="{{allusersinfo.profileimg}}">
{% else %}
<img class="img-cls-circle" src="{% static 'front/assets/img/blank.png' %}">
{% endif %}
{% endif %}
{% endfor %}
</div>
<div class="col-10 mt-4">
{% for allusers in allusers %}
{% if allusers.pk == allexpelorer.user_pk %}
{% if allusers.pk == user.pk %}
<h5 class="ml-2"><a href="/profile">{{allusers.first_name}} {{allusers.last_name}}
{% for allusersinfo in allusersinfo %}
{% if allusersinfo.user_pk == allusers.pk%}
{% if allusersinfo.celeberity == 'yes' %}
<i class="fas fa-user-check text-color-tripchiz"></i>
{% endif %}
{% endif %}
{% endfor %}
</a></h5>
{% else %}
<h5 class="ml-2"><a href="{% url 'fprofile' pk=allusers.pk %}">{{allusers.first_name}} {{allusers.last_name}}
{% for allusersinfo in allusersinfo %}
{% if allusersinfo.user_pk == allusers.pk%}
{% if allusersinfo.celeberity == 'yes' %}
<i class="fas fa-user-check text-color-tripchiz"></i>
{% endif %}
{% endif %}
{% endfor %}
</a></h5>
{% endif %}
{% endif %}
{% endfor %}
</div>
</div>
<div class="row ml-1">
<div class="col-12">
{% for allusersinfo in allusersinfo %}
{% for allusers in allusers %}
{% if allusersinfo.user_pk == allexpelorer.user_pk and allusers.pk == allexpelorer.user_pk %}
<small>Live in <a href="#">{{allusersinfo.live}}</a></small>
{% endif %}
{% endfor %}
{% endfor %}
<br>
{% for allusersinfo in allusersinfo %}
{% for allusers in allusers %}
{% if allusersinfo.user_pk == allusers.pk and allexpelorer.user_pk == allusers.pk %}
{% for allcommunities in allcommunities %}
{% if allcommunities.pk == allusersinfo.orginfrom %}
<small>From <a href="{% url 'comprofile' pk=allcommunities.pk %}">{{allcommunities.name}}</a></small>
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}
<br>
{% for allusers in allusers %}
{% if allusers.pk == allexpelorer.user_pk %}
<small><a href="#">{{allusers.username}}</a></small>
{% endif %}
{% endfor %}
</div>
</div>
<div class="row ml-1 mb-2 mt-1">
{% if allexpelorer.user_pk != user.pk %}
<div class="col-6">
<a href="{% url 'chatroom' pk=allexpelorer.user_pk %}" class="btn btn-primary">Message</a>
</div>
<div class="col-6">
<a href="{% url 'addfriend' pk=allexpelorer.user_pk %}" class="btn btn-primary">Add</a>
</div>
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% else %}
<div class="card bg-white card-inout">
<div class="card-body">
<div class="row">
<div class="col-12">
<h4 class="text-muted">There is no data to show.</h4>
<small class="text-muted">This community doesn't have any explorers.
</small>
</div>
</div>
</div>
</div>
{% endif %}
1条答案
按热度按时间avwztpqn1#
要从查询中获取唯一值,请执行以下操作:
或
myfriends
将具有唯一的值。