loko/streetup/panoramax/management/commands/setup_panoramax_view.py
2026-07-22 14:48:40 +02:00

32 lines
1.1 KiB
Python

from django.core.management.base import BaseCommand
from common.models import AppView
class Command(BaseCommand):
help = 'Creates the Panoramax AppView entry for navigation and permissions'
def handle(self, *args, **options):
panoramax_view, created = AppView.objects.update_or_create(
code='panoramax',
defaults={
'name_fr': 'Photos 360',
'name_nl': "360° Foto's",
'icon': 'bi-images',
'url_name': 'panoramax:index',
'is_default': False,
'order': 40
}
)
if created:
self.stdout.write(
self.style.SUCCESS(f'[OK] Successfully created Panoramax AppView (ID: {panoramax_view.id})')
)
else:
self.stdout.write(
self.style.WARNING(f'[WARN] Panoramax AppView already exists (ID: {panoramax_view.id})')
)
self.stdout.write('\nNext steps:')
self.stdout.write('1. Grant access to users via Django admin or shell:')
self.stdout.write(' user.config.accessible_views.add(panoramax_view)')