feat: new dynamic pages in admin panel

This commit is contained in:
mohamad
2026-05-25 17:17:27 +03:30
parent f08d0aacc0
commit cacf1ba77b
14 changed files with 818 additions and 149 deletions
@@ -0,0 +1,79 @@
# Generated by Django 5.0.2 on 2026-05-25 12:55
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0007_hero_section'),
]
operations = [
migrations.CreateModel(
name='CustomPage',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=200)),
('slug', models.SlugField(max_length=200, unique=True)),
('menu_label', models.CharField(blank=True, help_text='Nav label when shown in menu. Defaults to title.', max_length=100)),
('meta_description', models.CharField(blank=True, max_length=300)),
('show_in_nav', models.BooleanField(default=True)),
('menu_order', models.PositiveIntegerField(default=0)),
('is_published', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Custom Page',
'verbose_name_plural': 'Custom Pages',
'ordering': ['menu_order', 'title'],
},
),
migrations.CreateModel(
name='CustomPageSection',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('section_type', models.CharField(choices=[('hero', 'Hero'), ('intro', 'Intro Card'), ('grid', 'Grid Cards'), ('history', 'History Block'), ('custom', 'Custom Content'), ('features', 'Features Grid'), ('screenshots', 'Screenshots Gallery'), ('products', 'Products Grid'), ('problems', 'Problems / Value Proposition'), ('supporters', 'Supporters'), ('about_strip', 'About Strip'), ('faq', 'FAQ Accordion')], default='custom', max_length=30)),
('badge', models.CharField(blank=True, max_length=100)),
('title', models.CharField(blank=True, max_length=300)),
('subtitle', models.CharField(blank=True, max_length=500)),
('description', models.TextField(blank=True, help_text='Short intro text (homepage-style sections).')),
('content', models.TextField(blank=True)),
('content_format', models.CharField(choices=[('plain', 'Plain Text'), ('markdown', 'Markdown'), ('html', 'HTML')], default='markdown', max_length=20)),
('link_text', models.CharField(blank=True, max_length=100)),
('link_url', models.CharField(blank=True, max_length=300)),
('order', models.PositiveIntegerField(default=0)),
('is_active', models.BooleanField(default=True)),
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sections', to='pages.custompage')),
],
options={
'verbose_name': 'Custom Page Section',
'verbose_name_plural': 'Custom Page Sections',
'ordering': ['order'],
},
),
migrations.CreateModel(
name='CustomPageSectionItem',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('icon', models.CharField(blank=True, max_length=20)),
('badge', models.CharField(blank=True, max_length=100)),
('title', models.CharField(blank=True, max_length=300)),
('content', models.TextField(blank=True)),
('content_format', models.CharField(choices=[('plain', 'Plain Text'), ('markdown', 'Markdown'), ('html', 'HTML')], default='plain', max_length=20)),
('url', models.URLField(blank=True)),
('image', models.ImageField(blank=True, null=True, upload_to='pages/custom/')),
('image_alt', models.CharField(blank=True, max_length=200)),
('is_featured', models.BooleanField(default=False)),
('order', models.PositiveIntegerField(default=0)),
('section', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='pages.custompagesection')),
],
options={
'verbose_name': 'Custom Page Section Item',
'verbose_name_plural': 'Custom Page Section Items',
'ordering': ['order'],
},
),
]