Regenerated initial migrations for account, advertisement, commerce, configuration, and social apps to include recent schema changes and remove obsolete migration files. Added new migrations for Deutsche Post and Zasilkovna integrations, including new fields and choices. Updated commerce models to improve currency handling and discount code logic. This unifies the database schema and prepares for new features and integrations.
68 lines
5.0 KiB
Python
68 lines
5.0 KiB
Python
# Generated by Django 5.2.7 on 2026-01-24 22:44
|
|
|
|
import django.core.validators
|
|
from decimal import Decimal
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='SiteConfiguration',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(default='Shop name', max_length=100, unique=True)),
|
|
('logo', models.ImageField(blank=True, null=True, upload_to='shop_logos/')),
|
|
('favicon', models.ImageField(blank=True, null=True, upload_to='shop_favicons/')),
|
|
('contact_email', models.EmailField(blank=True, max_length=254, null=True)),
|
|
('contact_phone', models.CharField(blank=True, max_length=20, null=True)),
|
|
('contact_address', models.TextField(blank=True, null=True)),
|
|
('opening_hours', models.JSONField(blank=True, null=True)),
|
|
('facebook_url', models.URLField(blank=True, null=True)),
|
|
('instagram_url', models.URLField(blank=True, null=True)),
|
|
('youtube_url', models.URLField(blank=True, null=True)),
|
|
('tiktok_url', models.URLField(blank=True, null=True)),
|
|
('whatsapp_number', models.CharField(blank=True, max_length=20, null=True)),
|
|
('zasilkovna_shipping_price', models.DecimalField(decimal_places=2, default=Decimal('50.00'), max_digits=10)),
|
|
('zasilkovna_api_key', models.CharField(blank=True, help_text='API klíč pro přístup k Zásilkovna API (zatím není využito)', max_length=255, null=True)),
|
|
('zasilkovna_api_password', models.CharField(blank=True, help_text='API heslo pro přístup k Zásilkovna API (zatím není využito)', max_length=255, null=True)),
|
|
('free_shipping_over', models.DecimalField(decimal_places=2, default=Decimal('2000.00'), max_digits=10)),
|
|
('deutschepost_api_url', models.URLField(default='https://gw.sandbox.deutschepost.com', help_text='Deutsche Post API URL (sandbox/production)', max_length=255)),
|
|
('deutschepost_client_id', models.CharField(blank=True, help_text='Deutsche Post OAuth Client ID', max_length=255, null=True)),
|
|
('deutschepost_client_secret', models.CharField(blank=True, help_text='Deutsche Post OAuth Client Secret', max_length=255, null=True)),
|
|
('deutschepost_customer_ekp', models.CharField(blank=True, help_text='Deutsche Post Customer EKP number', max_length=20, null=True)),
|
|
('deutschepost_shipping_price', models.DecimalField(decimal_places=2, default=Decimal('6.00'), help_text='Default Deutsche Post shipping price in EUR', max_digits=10)),
|
|
('multiplying_coupons', models.BooleanField(default=True, help_text='Násobení kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón')),
|
|
('addition_of_coupons_amount', models.BooleanField(default=False, help_text='Sčítání slevových kupónů v objednávce (ano/ne), pokud ne tak se použije pouze nejvyšší slevový kupón')),
|
|
('currency', models.CharField(choices=[('EUR', 'Euro'), ('CZK', 'Czech Koruna'), ('USD', 'US Dollar'), ('GBP', 'British Pound'), ('PLN', 'Polish Zloty'), ('HUF', 'Hungarian Forint'), ('SEK', 'Swedish Krona'), ('DKK', 'Danish Krone'), ('NOK', 'Norwegian Krone'), ('CHF', 'Swiss Franc')], default='EUR', max_length=10)),
|
|
],
|
|
options={
|
|
'verbose_name': 'Shop Configuration',
|
|
'verbose_name_plural': 'Shop Configuration',
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='VATRate',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(help_text="E.g. 'German Standard', 'German Reduced', 'Czech Standard'", max_length=100)),
|
|
('description', models.TextField(blank=True, help_text="Optional description: 'Standard rate for most products', 'Books and food', etc.")),
|
|
('rate', models.DecimalField(decimal_places=4, help_text='VAT rate as percentage (e.g. 19.00 for 19%)', max_digits=5, validators=[django.core.validators.MinValueValidator(Decimal('0')), django.core.validators.MaxValueValidator(Decimal('100'))])),
|
|
('is_default', models.BooleanField(default=False, help_text='Default rate for new products')),
|
|
('is_active', models.BooleanField(default=True, help_text='Whether this VAT rate is active and available for use')),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
],
|
|
options={
|
|
'verbose_name': 'VAT Rate',
|
|
'verbose_name_plural': 'VAT Rates',
|
|
'ordering': ['-is_default', 'rate', 'name'],
|
|
},
|
|
),
|
|
]
|