forked from 42CTF/website
Compare commits
No commits in common. "94237bd9b61b575c74b678639936dd17ead67e16" and "bd17ad5f8f2c3675abbc379b16733847f78394a2" have entirely different histories.
94237bd9b6
...
bd17ad5f8f
|
@ -10,7 +10,7 @@ class userprofile(admin.ModelAdmin):
|
||||||
#list display
|
#list display
|
||||||
list_display = ['user', 'score', 'last_submission_date', 'campus']
|
list_display = ['user', 'score', 'last_submission_date', 'campus']
|
||||||
# search list
|
# search list
|
||||||
search_fields = ['score', 'user__username', 'campus__name']
|
search_fields = ['score', 'user__username', 'campus']
|
||||||
|
|
||||||
@admin.register(Campus)
|
@admin.register(Campus)
|
||||||
class campus(admin.ModelAdmin):
|
class campus(admin.ModelAdmin):
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
from collections import defaultdict
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
|
||||||
from accounts import models as acc_models
|
|
||||||
from django.contrib.auth import models as auth_models
|
|
||||||
from django.contrib.auth.models import timezone
|
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
help = 'Remove all users who never logged in'
|
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
|
||||||
all_users = acc_models.UserProfileInfo.objects.filter(score=0).select_related()
|
|
||||||
to_remove = []
|
|
||||||
for elem in all_users:
|
|
||||||
user = elem.user
|
|
||||||
if user.last_login is None and user.date_joined < timezone.now() - timedelta(hours=72):
|
|
||||||
to_remove.append(user)
|
|
||||||
print("You are going to remove {} users.".format(len(to_remove)))
|
|
||||||
answer = input("Continue ? [y/N] ")
|
|
||||||
|
|
||||||
if answer.lower() in ["y","yes"]:
|
|
||||||
for elem in to_remove:
|
|
||||||
elem.delete()
|
|
||||||
print("Users have been successfully pruned.")
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="row justify-content-md-center justify-content-sm-center">
|
<div class="row justify-content-md-center justify-content-sm-center">
|
||||||
<div class="col-4 col-sm-3 col-md-2 podium podium-two text-center">
|
<div class="col-4 col-sm-3 col-md-2 podium podium-two text-center">
|
||||||
<img src="{{ top3.1.0.logo }}" alt="{{ top3.1.0 }}"/>
|
<img src="{{ top3.1.0.logo }}" alt="{{ top3.1.0 }}" width="100%"/>
|
||||||
<h3>#2 :</h3>
|
<h3>#2 :</h3>
|
||||||
<p>
|
<p>
|
||||||
Score : {{ top3.1.1 }}
|
Score : {{ top3.1.1 }}
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4 col-sm-3 col-md-2 podium podium-one text-center">
|
<div class="col-4 col-sm-3 col-md-2 podium podium-one text-center">
|
||||||
<img src="{{ top3.0.0.logo }}" alt="{{ top3.0.0 }}"/>
|
<img src="{{ top3.0.0.logo }}" alt="{{ top3.0.0 }}" width="100%"/>
|
||||||
<h3>#1 : </h3>
|
<h3>#1 : </h3>
|
||||||
<p>
|
<p>
|
||||||
Score : {{ top3.0.1 }}
|
Score : {{ top3.0.1 }}
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4 col-sm-3 col-md-2 podium podium-three text-center">
|
<div class="col-4 col-sm-3 col-md-2 podium podium-three text-center">
|
||||||
<img src="{{ top3.2.0.logo }}" alt="{{ top3.2.0 }}"/>
|
<img src="{{ top3.2.0.logo }}" alt="{{ top3.2.0 }}" width="100%"/>
|
||||||
<h3>#3 : </h3>
|
<h3>#3 : </h3>
|
||||||
<p>
|
<p>
|
||||||
Score : {{ top3.2.1 }}
|
Score : {{ top3.2.1 }}
|
||||||
|
|
|
@ -320,7 +320,7 @@ footer {
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
.podium h3 {margin-top:-5%;}
|
.podium h3 {margin-top:-5%;}
|
||||||
.podium img{position:relative;top: -55px; max-height: 50px; max-width: 100%;}
|
.podium img{position:relative;top: -55px}
|
||||||
.podium-one{
|
.podium-one{
|
||||||
background-color: #313131;
|
background-color: #313131;
|
||||||
height: 25vh;}
|
height: 25vh;}
|
||||||
|
|
Loading…
Reference in New Issue