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,13 +72,24 @@ def leaderboard(request):
for i in media: for i in media:
username = i.user.username username = i.user.username
if f"{username}" in user_media.keys(): if f"{username}" in user_media.keys():
user_media[username] = 1 + user_media[username] user_media[username] += 1
else: else:
user_media[username] = 1 user_media[username] = 1
user_media = dict(sorted(user_media.items(), key=operator.itemgetter(0))) user_media = dict(sorted(user_media.items(), key=operator.itemgetter(0)))
user_media = dict(reversed(list(user_media.items()))) 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: while len(user_media) > 5:
user_media.pop() user_media.pop()

View File

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

View File

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