mirror of https://github.com/etesync/server
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
685 B
17 lines
685 B
from django.core.management.base import BaseCommand
|
|
from django.contrib.auth.models import Group
|
|
|
|
class Command(BaseCommand):
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument( 'name'
|
|
, type=str
|
|
, help="Name of the group to be deleted." )
|
|
|
|
def handle(self, *args, **options):
|
|
try:
|
|
Group.objects.get(name = options["name"]).delete()
|
|
self.stdout.write(self.style.SUCCESS(f'Grop "{options["name"]}" has been deleted.'))
|
|
except Group.DoesNotExist as exception:
|
|
self.stdout.write(self.style.ERROR(f'Unable to delete group "{options["name"]}": ' + str(exception)))
|