mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
fix: Remplacement des enum par des modèles pour les payementModes et les
payementPlans
This commit is contained in:
@ -2,11 +2,10 @@ import json
|
||||
import os
|
||||
from django.db.models.signals import post_migrate
|
||||
from django.dispatch import receiver
|
||||
from Establishment.models import Establishment
|
||||
from School.models import Domain, Category, Competency, EstablishmentCompetency
|
||||
from School.models import Domain, Category, Competency, PaymentModeType, PaymentPlanType
|
||||
|
||||
@receiver(post_migrate)
|
||||
def load_json_data(sender, **kwargs):
|
||||
def school_post_migrate(sender, **kwargs):
|
||||
if sender.name != "School":
|
||||
return
|
||||
|
||||
@ -47,4 +46,23 @@ def load_json_data(sender, **kwargs):
|
||||
level=competency_data.get('niveau'),
|
||||
category=category
|
||||
)
|
||||
print(f"Données importées depuis : {json_file_path}")
|
||||
print(f"Données importées depuis : {json_file_path}")
|
||||
|
||||
payment_mode_types = [
|
||||
{"code": "SEPA", "label": "Prélèvement SEPA"},
|
||||
{"code": "TRANSFER", "label": "Virement"},
|
||||
{"code": "CHECK", "label": "Chèque"},
|
||||
{"code": "CASH", "label": "Espèce"},
|
||||
]
|
||||
for mode in payment_mode_types:
|
||||
PaymentModeType.objects.get_or_create(code=mode["code"], defaults={"label": mode["label"]})
|
||||
|
||||
# ... après la création des PaymentModeType ...
|
||||
payment_plan_types = [
|
||||
{"code": "ONE_TIME", "label": "1 fois"},
|
||||
{"code": "THREE_TIMES", "label": "3 fois"},
|
||||
{"code": "TEN_TIMES", "label": "10 fois"},
|
||||
{"code": "TWELVE_TIMES", "label": "12 fois"},
|
||||
]
|
||||
for plan in payment_plan_types:
|
||||
PaymentPlanType.objects.get_or_create(code=plan["code"], defaults={"label": plan["label"]})
|
||||
Reference in New Issue
Block a user