mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
chore: commit qui sert à rien
This commit is contained in:
24
Back-End/School/management/commands/init_establishment.py
Normal file
24
Back-End/School/management/commands/init_establishment.py
Normal file
@ -0,0 +1,24 @@
|
||||
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'))
|
||||
Reference in New Issue
Block a user