Skip to content

Commit

Permalink
feat: start of profile info command
Browse files Browse the repository at this point in the history
  • Loading branch information
tuneerroy committed Nov 6, 2023
1 parent c3c32a9 commit d1fa3db
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions backend/user/management/commands/profile_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand

User = get_user_model()


class Command(BaseCommand):
help = """
Shows all user information given a pennkey or an email.
"""

def add_arguments(self, parser):
parser.add_argument("--pennkey", type=str, help="pennkey")
parser.add_argument("--email", type=str, help="email")

def handle(self, *args, **kwargs):
if kwargs["pennkey"] is None and kwargs["email"] is None:
self.stdout.write("Please provide a pennkey or an email.")
return

if kwargs["pennkey"] is not None:
users = User.objects.filter(username=kwargs["pennkey"])
if
else:
users = User.objects.filter(email=kwargs["email"])


0 comments on commit d1fa3db

Please sign in to comment.