small adjustments

This commit is contained in:
Yamozha 2021-07-21 00:16:44 +03:00
parent 9c4b37d775
commit 46256d328e
6 changed files with 21 additions and 8 deletions

Binary file not shown.

View File

@ -72,12 +72,23 @@ def leaderboard(request):
for i in media:
username = i.user.username
if f"{username}" in user_media.keys():
user_media[username] = 1 + user_media[username]
user_media[username] += 1
else:
user_media[username] = 1
user_media = dict(sorted(user_media.items(), key=operator.itemgetter(0)))
user_media = dict(reversed(list(user_media.items())))
print(user_media)
users = {}
for i in user_media.keys():
iter_user = User.objects.get(username=i)
iter_user_media = Media.objects.filter(user=iter_user)
if iter_user_media.filter(is_video=True):
user_data = {i:{"Videos":len(iter_user_media.filter(is_video=True)),
"Images":len(iter_user_media.filter(is_video=False))}}
else:
user_data = {i:{"Images":len(iter_user_media.filter(is_video=False))}}
print(user_data)
while len(user_media) > 5:
user_media.pop()

View File

@ -71,6 +71,7 @@
{% block content %}
{% endblock %}
<script type="text/javascript" src="{% static 'home/js/mobile.js' %}"></script>
</body>
</html>

View File

@ -61,7 +61,6 @@
<a href="https://www.youtube.com/channel/UCIWblGtjXAxwbTMUbhZ_PDQ"><img src="{% static 'home/img/youtube.png' %}" style="max-width:100px;" ></a>
</p>
</div>
<script type="text/javascript" src="{% static 'home/js/mobile.js' %}"></script>
<footer>Frontend, backend and planning:<br> <a class="footer" href="https://yamozha.xyz">Boyan</a></footer>
{% endblock %}

View File

@ -34,7 +34,7 @@ a {
}
.container {
width: 300px;
width: 500px;
height: auto;
border-radius: 10px;
background-color: white;
@ -62,13 +62,15 @@ a {
overflow: hidden;
}
@media only screen and (max-width: 800px) {
@media only screen and (max-width: 1000px) {
.container{
width: fit-content;
top:40%;
left:50%;
}
.container-2{
width: fit-content;
top:80%;
left:50%;
}
@ -87,7 +89,7 @@ a {
text-align: center;
}
.leaderboard .head h1 {
display: inline-block;
display: flex;
margin-left: 4px;
}
@ -145,7 +147,7 @@ a {
</div>
<div class="body">
<ol>
{% for i, z in user_media.items %}
{% for i, z in user_media.items reversed %}
<li>
<mark>{{ i }}</mark>
<small>{{z}} снимки и видеа</small>