apps.py 602 B

123456789101112131415161718192021222324252627282930
  1. import sys
  2. from django.apps import AppConfig
  3. class WikiConfig(AppConfig):
  4. default_auto_field = 'django.db.models.BigAutoField'
  5. name = 'wiki'
  6. def ready(self):
  7. if 'migrate' in sys.argv:
  8. return
  9. print("-- Démarage du Wiki --")
  10. print(">> Vérification des variables d'environement")
  11. from core.models import Page
  12. try :
  13. page = Page.objects.get(p_titre_slugify = "wiki")
  14. except :
  15. page = Page()
  16. page.p_titre = "Wiki"
  17. page.p_icone = "fas fa-book-dead"
  18. page.p_adresse = "/wiki/"
  19. page.p_menu_position = "haut"
  20. page.p_type = "sys"
  21. page.p_menu_poid = 30
  22. page.save()