52 lines
2.1 KiB
Python
52 lines
2.1 KiB
Python
|
|
from django.apps import AppConfig
|
|||
|
|
|
|||
|
|
|
|||
|
|
class CoreConfig(AppConfig):
|
|||
|
|
default_auto_field = 'django.db.models.BigAutoField'
|
|||
|
|
name = 'core'
|
|||
|
|
verbose_name = 'управление сайтом'
|
|||
|
|
|
|||
|
|
def ready(self):
|
|||
|
|
from core.models import Rate, StaticPage, StaticBlock, Document
|
|||
|
|
|
|||
|
|
currencies = ['rub-jpy', 'rub-krw']
|
|||
|
|
for currencie in currencies:
|
|||
|
|
Rate.objects.get_or_create(slug=currencie)
|
|||
|
|
|
|||
|
|
page = StaticPage.objects.filter(slug='personal_data').first()
|
|||
|
|
if not page:
|
|||
|
|
StaticPage.objects.create(
|
|||
|
|
title='Политика обработки персональных данных',
|
|||
|
|
slug='personal_data',
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
titles = [
|
|||
|
|
('Телефон', '8 800 123-45-67'),
|
|||
|
|
('Whatsapp ссылка', 'https://www.whatsapp.com/'),
|
|||
|
|
('Vk ссылка', 'https://vk.com/'),
|
|||
|
|
('Vk написать', 'https://vk.com/'),
|
|||
|
|
('Telegram ссылка', 'https://t.me/'),
|
|||
|
|
('Youtube ссылка', 'https://youtube.com/'),
|
|||
|
|
('Instagram ссылка', 'https://instagram.com/'),
|
|||
|
|
('Отзывы яндекс ссылка', 'https://ya.ru/'),
|
|||
|
|
('Отзывы 2гис ссылка', 'https://2gis.ru/'),
|
|||
|
|
('Адрес Красноярск', 'https://2gis.ru/'),
|
|||
|
|
('Адрес Новосибирск', 'https://2gis.ru/'),
|
|||
|
|
('Адрес Владивосток', 'https://2gis.ru/'),
|
|||
|
|
]
|
|||
|
|
for title in titles:
|
|||
|
|
static_block, created = StaticBlock.objects.get_or_create(title=title[0])
|
|||
|
|
if created:
|
|||
|
|
static_block.content = title[1]
|
|||
|
|
static_block.save()
|
|||
|
|
|
|||
|
|
documents = [
|
|||
|
|
('Пример нашего договора', 'agreement'),
|
|||
|
|
('Пример таможенных документов', 'customs_document'),
|
|||
|
|
]
|
|||
|
|
for document in documents:
|
|||
|
|
curr_document, created = Document.objects.get_or_create(slug=document[1])
|
|||
|
|
if created:
|
|||
|
|
curr_document.title = document[0]
|
|||
|
|
curr_document.save()
|