40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""
|
|
Management command to set up the Schools AppView.
|
|
|
|
Usage:
|
|
python manage.py setup_schools_view
|
|
"""
|
|
from django.core.management.base import BaseCommand
|
|
from common.models import AppView
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = 'Creates the Schools AppView entry for navigation and permissions'
|
|
|
|
def handle(self, *args, **options):
|
|
schools_view, created = AppView.objects.get_or_create(
|
|
code='schools',
|
|
defaults={
|
|
'name_fr': 'Écoles',
|
|
'name_nl': 'Scholen',
|
|
'icon': 'bi-building',
|
|
'url_name': 'schools:index',
|
|
'is_default': False,
|
|
'order': 30
|
|
}
|
|
)
|
|
|
|
if created:
|
|
self.stdout.write(
|
|
self.style.SUCCESS(f'✓ Successfully created Schools AppView (ID: {schools_view.id})')
|
|
)
|
|
else:
|
|
self.stdout.write(
|
|
self.style.WARNING(f'⚠ Schools AppView already exists (ID: {schools_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(schools_view)')
|
|
self.stdout.write('2. Configure email settings in .env or settings.py')
|
|
self.stdout.write('3. Create media directories for file uploads')
|