Refactor Stripe payment handling and order status
Refactored Stripe payment integration to use a dedicated Stripe model for session data, updating the PaymentSerializer accordingly. Renamed Order.Status to Order.OrderStatus for clarity. Updated configuration app to ensure SiteConfiguration singleton is created post-migration. Removed obsolete seed_app_config command from docker-compose. Adjusted frontend API generated files and moved orval config.
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
from django.apps import AppConfig
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
from django.db.models.signals import post_migrate
|
||||
|
||||
def create_site_config(sender, **kwargs):
|
||||
"""
|
||||
Ensure the SiteConfiguration singleton exists after migrations.
|
||||
"""
|
||||
from .models import SiteConfiguration
|
||||
try:
|
||||
SiteConfiguration.get_solo()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
class ConfigurationConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'configuration'
|
||||
|
||||
def ready(self):
|
||||
"""Ensure the SiteConfiguration singleton exists at startup.
|
||||
Wrapped in broad DB error handling so that commands like
|
||||
makemigrations/migrate don't fail when the table does not yet exist.
|
||||
"""
|
||||
try:
|
||||
from .models import SiteConfiguration # local import to avoid premature app registry access
|
||||
SiteConfiguration.get_solo() # creates if missing
|
||||
|
||||
except (OperationalError, ProgrammingError):
|
||||
# DB not ready (e.g., before initial migrate); ignore silently
|
||||
pass
|
||||
# Spustí create_site_config po dokončení migrací
|
||||
post_migrate.connect(create_site_config, sender=self)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user