* Add github action to codespell preview on push and PRs
* Add rudimentary codespell config
* [DATALAD RUNCMD] chore: run codespell throughout fixing a few typos interactively
=== Do not change lines below ===
{
"chain": [],
"cmd": "codespell -w -i 3 -C 4 ./apps/web/core/components/workspace/delete-workspace-form.tsx ./deployments/cli/community/README.md",
"exit": 0,
"extra_inputs": [],
"inputs": [],
"outputs": [],
"pwd": "."
}
^^^ Do not change lines above ^^^
* Adjust coespell regex to ignore all camelCased words
* [DATALAD RUNCMD] chore: run codespell throughout fixing a few new typos automagically
=== Do not change lines below ===
{
"chain": [],
"cmd": "codespell -w",
"exit": 0,
"extra_inputs": [],
"inputs": [],
"outputs": [],
"pwd": "."
}
^^^ Do not change lines above ^^^
34 lines
990 B
Python
34 lines
990 B
Python
# Django imports
|
|
from django.core.management import BaseCommand, CommandError
|
|
|
|
# Module imports
|
|
from plane.db.models import User
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Make the user with the given email active"
|
|
|
|
def add_arguments(self, parser):
|
|
# Positional argument
|
|
parser.add_argument("email", type=str, help="user email")
|
|
|
|
def handle(self, *args, **options):
|
|
# get the user email from console
|
|
email = options.get("email", False)
|
|
|
|
# raise error if email is not present
|
|
if not email:
|
|
raise CommandError("Error: Email is required")
|
|
|
|
# filter the user
|
|
user = User.objects.filter(email=email).first()
|
|
|
|
# Raise error if the user is not present
|
|
if not user:
|
|
raise CommandError(f"Error: User with {email} does not exists")
|
|
|
|
# Activate the user
|
|
user.is_active = True
|
|
user.save()
|
|
|
|
self.stdout.write(self.style.SUCCESS("User activated successfully"))
|