84 lines
4.4 KiB
Python
84 lines
4.4 KiB
Python
# Generated by Django 5.2.19 on 2026-11-21 16:27
|
||
|
||
import catalog.models
|
||
import django.core.validators
|
||
import django.db.models.deletion
|
||
import uuid
|
||
from django.conf import settings
|
||
from django.db import migrations, models
|
||
|
||
|
||
class Migration(migrations.Migration):
|
||
|
||
dependencies = [
|
||
('catalog', '0006_homepage_countdown'),
|
||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||
]
|
||
|
||
operations = [
|
||
migrations.CreateModel(
|
||
name='BookListing',
|
||
fields=[
|
||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||
('title', models.CharField(max_length=160)),
|
||
('description', models.TextField(blank=True, max_length=1500)),
|
||
('cover', models.ImageField(blank=True, upload_to=catalog.models.image_path, validators=[catalog.models.validate_image])),
|
||
('paypal_url', models.URLField(validators=[catalog.models.validate_book_checkout], verbose_name='PayPal Payment Link')),
|
||
('visible', models.BooleanField(default=False)),
|
||
],
|
||
options={
|
||
'ordering': ['title', 'pk'],
|
||
},
|
||
),
|
||
migrations.AddField(
|
||
model_name='chapter',
|
||
name='price_usd',
|
||
field=models.DecimalField(blank=True, decimal_places=2, help_text='Leave blank or set to zero for a free chapter.', max_digits=7, null=True, validators=[django.core.validators.MinValueValidator(0)], verbose_name='Chapter price (USD)'),
|
||
),
|
||
migrations.AddField(
|
||
model_name='sitesettings',
|
||
name='homepage_countdown_cover',
|
||
field=models.ImageField(blank=True, help_text='Upload a cover specifically for this public countdown.', upload_to=catalog.models.image_path, validators=[catalog.models.validate_image], verbose_name='Chapter cover'),
|
||
),
|
||
migrations.AddField(
|
||
model_name='sitesettings',
|
||
name='homepage_countdown_cta_label',
|
||
field=models.CharField(blank=True, max_length=60, verbose_name='Button label'),
|
||
),
|
||
migrations.AddField(
|
||
model_name='sitesettings',
|
||
name='homepage_countdown_cta_url',
|
||
field=models.URLField(blank=True, help_text='Paste the HTTPS link to your mailing-list signup or other destination.', validators=[django.core.validators.URLValidator(schemes=['https'])], verbose_name='Button URL'),
|
||
),
|
||
migrations.AddField(
|
||
model_name='sitesettings',
|
||
name='homepage_countdown_landing',
|
||
field=models.BooleanField(default=False, help_text='Replaces the homepage while the countdown is active. The regular homepage returns at zero.', verbose_name='Use a full landing page'),
|
||
),
|
||
migrations.AddField(
|
||
model_name='sitesettings',
|
||
name='homepage_countdown_note',
|
||
field=models.TextField(blank=True, max_length=1500, verbose_name='Author’s comment'),
|
||
),
|
||
migrations.CreateModel(
|
||
name='ChapterPurchase',
|
||
fields=[
|
||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||
('mode', models.CharField(choices=[('sandbox', 'Sandbox'), ('live', 'Live')], max_length=7)),
|
||
('amount', models.DecimalField(decimal_places=2, max_digits=7)),
|
||
('checkout_id', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
|
||
('paypal_order_id', models.CharField(blank=True, max_length=64)),
|
||
('approval_url', models.URLField(blank=True, max_length=500)),
|
||
('capture_id', models.CharField(blank=True, max_length=64, null=True, unique=True)),
|
||
('paid_at', models.DateTimeField(blank=True, null=True)),
|
||
('revoked', models.BooleanField(default=False)),
|
||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||
('chapter', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='purchases', to='catalog.chapter')),
|
||
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||
],
|
||
options={
|
||
'constraints': [models.UniqueConstraint(fields=('user', 'chapter', 'mode'), name='slx_unique_chapter_purchase')],
|
||
},
|
||
),
|
||
]
|