123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- import sys
- from django.apps import AppConfig
- class ParcInfoConfig(AppConfig):
- default_auto_field = 'django.db.models.BigAutoField'
- name = 'parc_info'
- verbose_name = 'Parc Informatique'
- def ready(self):
- if 'migrate' in sys.argv:
- return
-
- print("-- Démarage de la gestion du Parc --")
- print(">> Vérification des variables d'environement")
- from core.models import Data
- try :
- data = Data.objects.get(d_titre_slugify = "range-imp")
- except:
- data = Data()
- data.d_titre = "range-imp"
- data.d_type = "IMP"
- data.d_variable = "900;999"
- data.save()
- try :
- data = Data.objects.get(d_titre_slugify = "range-pc")
- except:
- data = Data()
- data.d_titre = "range-pc"
- data.d_type = "PC"
- data.d_variable = "1;899"
- data.save()
- print(">> Vérification des pages")
- from core.models import Page
- try :
- page = Page.objects.get(p_titre_slugify = "parc")
- except :
- page = Page()
- page.p_titre = "Parc"
- page.p_icone = "fas fa-map-marked-alt"
- page.p_adresse = "/parc"
- page.p_menu_position = "haut"
- page.p_menu_est_parent = "True"
- page.p_type = "sys"
- page.p_menu_poid = 90
- page.p_publier = False
-
- page.save()
- tmp_page_parent = page
- try :
- page = Page.objects.get(p_titre_slugify = "les-equipements-utilisateurs")
- except :
- page = Page()
- page.p_titre = "Les équipements utilisateurs"
- page.p_icone = "fas fa-desktop"
- page.p_adresse = "/parc/clients"
- page.p_menu_position = "haut"
- page.p_menu_est_parent = "False"
- page.p_menu_parent = tmp_page_parent
- page.p_type = "sys"
- page.p_menu_poid = 90
- page.p_publier = True
- page.save()
- try :
- page = Page.objects.get(p_titre_slugify = "les-serveurs")
- except :
- page = Page()
- page.p_titre = "Les serveurs"
- page.p_icone = "fas fa-server"
- page.p_adresse = "/parc/serveurs"
- page.p_menu_position = "haut"
- page.p_menu_est_parent = "False"
- page.p_menu_parent = tmp_page_parent
- page.p_type = "sys"
- page.p_menu_poid = 90
- page.p_publier = True
- page.save()
- try :
- page = Page.objects.get(p_titre_slugify = "les-switchs")
- except :
- page = Page()
- page.p_titre = "Les switchs"
- page.p_icone = "fas fa-ethernet"
- page.p_adresse = "/parc/switch"
- page.p_menu_position = "haut"
- page.p_menu_est_parent = "False"
- page.p_menu_parent = tmp_page_parent
- page.p_type = "sys"
- page.p_menu_poid = 90
- page.p_publier = True
- page.save()
- try :
- page = Page.objects.get(p_titre_slugify = "listing-des-imprimantes")
- except :
- page = Page()
- page.p_titre = "Listing des imprimantes"
- page.p_icone = "fas fa-print"
- page.p_adresse = "/parc/clients/imp"
- page.p_menu_position = "haut"
- page.p_menu_est_parent = "False"
- page.p_menu_parent = tmp_page_parent
- page.p_type = "sys"
- page.p_menu_poid = 90
- page.p_publier = True
- page.save()
- try :
- page = Page.objects.get(p_titre_slugify = "inventaire")
- except :
- page = Page()
- page.p_titre = "Inventaire par services"
- page.p_titre_slugify = "inventaire"
- page.p_icone = "fas fa-boxes"
- page.p_adresse = "/parc/clients/stat/par-services"
- page.p_menu_position = "haut"
- page.p_menu_est_parent = "False"
- page.p_menu_parent = tmp_page_parent
- page.p_type = "sys"
- page.p_menu_poid = 90
- page.p_publier = True
- page.save()
|