Fixes: 1) None; Extra: 1) Update comment to outline pending group creation tasks.
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
import logging
|
|
from typing import Any
|
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
from engine.core.models import Vendor
|
|
from engine.vibes_auth.models import Group
|
|
from django.contrib.auth.models import Permission
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class Command(BaseCommand):
|
|
def handle(self, *args: list[Any], **options: dict[Any, Any]) -> None:
|
|
self.stdout.write("Initializing must-have instances...")
|
|
|
|
Vendor.objects.get_or_create(name="INNER")
|
|
Group.objects.get_or_create(name="User Support")
|
|
Permission.objects.all()
|
|
# TODO get_or_create a group "Product Listing Administrator" with corresponding permissions
|
|
# TODO get_or_create a group "Head Product Listing Administrator" with corresponding permissions
|
|
# TODO get_or_create a group "E-Commerce Administrator" with corresponding permissions
|
|
|
|
# maybe use some .json file for future updates?.. Say, use the engine/core/fixtures/initialization.json
|
|
self.stdout.write(self.style.SUCCESS("Successfully initialized must-have instances!"))
|