2025.12.23 17:30:33 (cachyos.cmoser.eu)
This commit is contained in:
92
tinywiki/migrations/0004_sidebar.py
Normal file
92
tinywiki/migrations/0004_sidebar.py
Normal file
@@ -0,0 +1,92 @@
|
||||
# Generated by Django 5.2.9 on 2025-12-23 15:59
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
@staticmethod
|
||||
def create_tinywiki_sections(apps, schema_editor):
|
||||
from tinywiki.models import SidebarSection, SidebarEntry
|
||||
|
||||
data = [
|
||||
{
|
||||
"title": "TinyWiki Pages",
|
||||
"is_visible": True,
|
||||
"priority": 1000,
|
||||
"items": [
|
||||
{
|
||||
"title": "BBCode Guide",
|
||||
"is_visible": True,
|
||||
"priority": 100,
|
||||
"wiki_slug": "tw-bbcode",
|
||||
},
|
||||
{
|
||||
"title": "Markdown Guide",
|
||||
"is_visible": True,
|
||||
"priority": 90,
|
||||
"wiki_slug": "tw-markdown"
|
||||
},
|
||||
{
|
||||
"title": "TinyWiki License",
|
||||
"is_visible": True,
|
||||
"priority": 80,
|
||||
"wiki_slug": "tw-license"
|
||||
},
|
||||
{
|
||||
"title": "Bootstrap License",
|
||||
"is_visible": True,
|
||||
"priority": 70,
|
||||
"wiki_slug": "tw-bootstrap-license"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "TinyWiki Seiten",
|
||||
"is_visible": False,
|
||||
"priority": 1000,
|
||||
"items": [
|
||||
{
|
||||
"title": "BBCode Anleitung",
|
||||
"is_visible": True,
|
||||
"priority": 100,
|
||||
"wiki_slug": "tw-de-bbcode",
|
||||
},
|
||||
{
|
||||
"title": "Markdown Anleitung",
|
||||
"is_visible": True,
|
||||
"priority": 90,
|
||||
"wiki_slug": "tw-de-markdown"
|
||||
},
|
||||
{
|
||||
"title": "TinyWiki Lizenz (EN)",
|
||||
"is_visible": True,
|
||||
"priority": 80,
|
||||
"wiki_slug": "tw-license"
|
||||
},
|
||||
{
|
||||
"title": "Bootstrap License (EN)",
|
||||
"is_visible": True,
|
||||
"priority": 70,
|
||||
"wiki_slug": "tw-bootstrap-license"
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
for sect_spec in data:
|
||||
if 'items' in sect_spec:
|
||||
items = sect_spec.pop('items')
|
||||
else:
|
||||
items = []
|
||||
|
||||
section = SidebarSection.objects.create(**sect_spec)
|
||||
for item_spec in items:
|
||||
SidebarEntry.objects.create(section=section, **item_spec)
|
||||
|
||||
dependencies = [
|
||||
('tinywiki', '0003_sidebarsection_alter_page_status_data_sidebarentry'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
]
|
||||
Reference in New Issue
Block a user