2022-01-06 04:22:12 +00:00
|
|
|
from datetime import timedelta
|
2023-08-10 11:27:31 -04:00
|
|
|
|
|
|
|
from django.core.management.base import BaseCommand
|
2022-01-06 04:22:12 +00:00
|
|
|
from django.utils import timezone
|
|
|
|
|
2023-08-10 11:27:31 -04:00
|
|
|
from users.models import User
|
|
|
|
|
2022-01-06 04:22:12 +00:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
2023-01-11 19:11:31 -05:00
|
|
|
help = "disable user"
|
2022-01-06 04:22:12 +00:00
|
|
|
|
|
|
|
def add_arguments(self, parser):
|
2023-01-11 19:11:31 -05:00
|
|
|
parser.add_argument("id", type=int, help="user id")
|
2022-01-06 04:22:12 +00:00
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
2023-01-11 19:11:31 -05:00
|
|
|
h = int(options["id"])
|
2023-06-30 23:53:53 -04:00
|
|
|
u = User.objects.get(pk=h)
|
2022-01-06 04:22:12 +00:00
|
|
|
u.is_active = False
|
|
|
|
u.save()
|
2023-06-30 23:53:53 -04:00
|
|
|
print(f"{u} disabled")
|