Compare commits

..

No commits in common. "32bbc392d666e2c4d96ea89e5108fe6ea52e53c3" and "cce09ed2542758f07dada56687f5e36952e66452" have entirely different histories.

3 changed files with 1 additions and 32 deletions

View File

@ -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.")

View File

@ -92,13 +92,6 @@
{% endif %} {% endif %}
<li class="list-group-item">{% trans "Registered since" %} {{ user.date_joined|date:"Y-m-d" }}</li> <li class="list-group-item">{% trans "Registered since" %} {{ user.date_joined|date:"Y-m-d" }}</li>
</ul> </ul>
<ul class="list-group">
<form method='GET' action="{% url 'accounts:profile' user %}">
<li class="list-group-item">
<input class="form-control" type="submit" value="{% trans " View my profile" %}">
</li>
</form>
</ul>
<ul class="list-group"> <ul class="list-group">
<form method='GET' action="{% url 'accounts:delete_account' %}"> <form method='GET' action="{% url 'accounts:delete_account' %}">
{%csrf_token%} {%csrf_token%}

View File

@ -95,7 +95,7 @@
<a href="{% url 'accounts:edit' %}" class="nav-link">{{ request.user.username }}</a> <a href="{% url 'accounts:edit' %}" class="nav-link">{{ request.user.username }}</a>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link" href="{% url 'accounts:profile' user %}">{{ request.user.userprofileinfo.score }}</a> <span class="nav-link">{{ request.user.userprofileinfo.score }}</span>
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link" href="{% url 'accounts:out' %}">{% translate "Logout" %}</a> <a class="nav-link" href="{% url 'accounts:out' %}">{% translate "Logout" %}</a>