Compare commits

...

6 Commits

4 changed files with 29 additions and 5 deletions

View File

@ -10,7 +10,7 @@ class userprofile(admin.ModelAdmin):
#list display
list_display = ['user', 'score', 'last_submission_date', 'campus']
# search list
search_fields = ['score', 'user__username', 'campus']
search_fields = ['score', 'user__username', 'campus__name']
@admin.register(Campus)
class campus(admin.ModelAdmin):

View File

@ -0,0 +1,24 @@
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.")

View File

@ -8,7 +8,7 @@
<div class="col-12">
<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">
<img src="{{ top3.1.0.logo }}" alt="{{ top3.1.0 }}" width="100%"/>
<img src="{{ top3.1.0.logo }}" alt="{{ top3.1.0 }}"/>
<h3>#2 :</h3>
<p>
Score : {{ top3.1.1 }}
@ -17,7 +17,7 @@
</p>
</div>
<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 }}" width="100%"/>
<img src="{{ top3.0.0.logo }}" alt="{{ top3.0.0 }}"/>
<h3>#1 : </h3>
<p>
Score : {{ top3.0.1 }}
@ -26,7 +26,7 @@
</p>
</div>
<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 }}" width="100%"/>
<img src="{{ top3.2.0.logo }}" alt="{{ top3.2.0 }}"/>
<h3>#3 : </h3>
<p>
Score : {{ top3.2.1 }}

View File

@ -320,7 +320,7 @@ footer {
vertical-align: bottom;
}
.podium h3 {margin-top:-5%;}
.podium img{position:relative;top: -55px}
.podium img{position:relative;top: -55px; max-height: 50px; max-width: 100%;}
.podium-one{
background-color: #313131;
height: 25vh;}