mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 14:31:08 -05:00
- Cleaned up and standardized assertions in ApiTestMixin for API response validation. - Updated ASGI settings to use os.environ for setting the DJANGO_SETTINGS_MODULE. - Removed unused imports and improved formatting in settings.py. - Refactored URL patterns in urls.py for better readability and organization. - Enhanced view functions in views.py for consistency and clarity. - Added .flake8 configuration for linting and style enforcement. - Introduced type stubs for django-environ to improve type checking with Pylance.
130 lines
4.8 KiB
Python
130 lines
4.8 KiB
Python
# Generated by Django 5.2.5 on 2025-08-16 17:42
|
|
|
|
import django.db.models.functions.datetime
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("parks", "0002_alter_parkarea_unique_together"),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddConstraint(
|
|
model_name="park",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
("closing_date__isnull", True),
|
|
("opening_date__isnull", True),
|
|
("closing_date__gte", models.F("opening_date")),
|
|
_connector="OR",
|
|
),
|
|
name="park_closing_after_opening",
|
|
violation_error_message="Closing date must be after opening date",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="park",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
("size_acres__isnull", True),
|
|
("size_acres__gt", 0),
|
|
_connector="OR",
|
|
),
|
|
name="park_size_positive",
|
|
violation_error_message="Park size must be positive",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="park",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
("average_rating__isnull", True),
|
|
models.Q(("average_rating__gte", 1), ("average_rating__lte", 10)),
|
|
_connector="OR",
|
|
),
|
|
name="park_rating_range",
|
|
violation_error_message="Average rating must be between 1 and 10",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="park",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
("ride_count__isnull", True),
|
|
("ride_count__gte", 0),
|
|
_connector="OR",
|
|
),
|
|
name="park_ride_count_non_negative",
|
|
violation_error_message="Ride count must be non-negative",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="park",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
("coaster_count__isnull", True),
|
|
("coaster_count__gte", 0),
|
|
_connector="OR",
|
|
),
|
|
name="park_coaster_count_non_negative",
|
|
violation_error_message="Coaster count must be non-negative",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="park",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
("coaster_count__isnull", True),
|
|
("ride_count__isnull", True),
|
|
("coaster_count__lte", models.F("ride_count")),
|
|
_connector="OR",
|
|
),
|
|
name="park_coaster_count_lte_ride_count",
|
|
violation_error_message="Coaster count cannot exceed total ride count",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="parkreview",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(("rating__gte", 1), ("rating__lte", 10)),
|
|
name="park_review_rating_range",
|
|
violation_error_message="Rating must be between 1 and 10",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="parkreview",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
(
|
|
"visit_date__lte",
|
|
django.db.models.functions.datetime.Now(),
|
|
)
|
|
),
|
|
name="park_review_visit_date_not_future",
|
|
violation_error_message="Visit date cannot be in the future",
|
|
),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="parkreview",
|
|
constraint=models.CheckConstraint(
|
|
condition=models.Q(
|
|
models.Q(
|
|
("moderated_at__isnull", True),
|
|
("moderated_by__isnull", True),
|
|
),
|
|
models.Q(
|
|
("moderated_at__isnull", False),
|
|
("moderated_by__isnull", False),
|
|
),
|
|
_connector="OR",
|
|
),
|
|
name="park_review_moderation_consistency",
|
|
violation_error_message="Moderated reviews must have both moderator and moderation timestamp",
|
|
),
|
|
),
|
|
]
|