mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
24 lines
877 B
Python
24 lines
877 B
Python
from django.core.management.base import BaseCommand
|
|
from School.models import Establishment, StructureType
|
|
|
|
class Command(BaseCommand):
|
|
help = 'Initialize the establishment'
|
|
|
|
def handle(self, *args, **kwargs):
|
|
establishment_data = {
|
|
"name": "N3WT",
|
|
"address": "Société n3wt-innov 69 Chez LANA",
|
|
"total_capacity": 69,
|
|
"establishment_type": [StructureType.MATERNELLE, StructureType.PRIMAIRE],
|
|
"licence_code": ""
|
|
}
|
|
|
|
establishment, created = Establishment.objects.update_or_create(
|
|
name=establishment_data["name"],
|
|
defaults=establishment_data
|
|
)
|
|
|
|
if created:
|
|
self.stdout.write(self.style.SUCCESS('Establishment created successfully'))
|
|
else:
|
|
self.stdout.write(self.style.SUCCESS('Establishment updated successfully')) |