utils.py 1.9 KB

123456789101112131415161718192021222324252627
  1. from butler.models import ButlerPage
  2. def create_pages_clean():
  3. if not ButlerPage.objects.filter(slug='order'):
  4. ButlerPage.objects.create(title="Главная", slug="main", content="")
  5. ButlerPage.objects.create(title="Заказ онлайн", slug="order", content="")
  6. ButlerPage.objects.create(title="FAQ", slug="faq", content="")
  7. ButlerPage.objects.create(title="Цены", slug="price", content="")
  8. ButlerPage.objects.create(title="Контакты", slug="contact", content="")
  9. if not ButlerPage.objects.filter(slug__startswith="clean"):
  10. ButlerPage.objects.create(title="Уборка автосалонов", slug="clean-car", content="")
  11. ButlerPage.objects.create(title="Уборка фитнес клубов", slug="clean-fit", content="")
  12. ButlerPage.objects.create(title="Уборка офисов, ТЦ и БЦ", slug="clean-office", content="")
  13. ButlerPage.objects.create(title="Уборка ТСЖ", slug="clean-tcj", content="")
  14. ButlerPage.objects.create(title="Уборка прилегающей территории", slug="clean-area", content="")
  15. ButlerPage.objects.create(title="Мойка фасадов и остекления", slug="clean-facades", content="")
  16. ButlerPage.objects.create(title="Комплексная уборка квартир", slug="clean-apartments", content="")
  17. ButlerPage.objects.create(title="Комплексная уборка коттеджей", slug="clean-cottages", content="")
  18. ButlerPage.objects.create(title="Генеральная уборка", slug="clean-out", content="")
  19. ButlerPage.objects.create(title="Уборка после ремонта", slug="clean-renovation", content="")
  20. def create_pages_clean_admin(modeladmin, request, queryset):
  21. create_pages_clean()
  22. create_pages_clean_admin.short_description = "Созадть страницы по умолчанию"