Refactor URL patterns for parks and rides; update context fields in models to use ForeignKey for pghistory.Context

This commit is contained in:
pacnpal
2025-02-10 10:54:34 -05:00
parent 9ed28b15b4
commit b4c474c496
12 changed files with 670 additions and 495 deletions

View File

@@ -86,16 +86,16 @@ class Migration(migrations.Migration):
("closing_date", models.DateField(blank=True, null=True)),
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"park",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="areas",
to=PARKS_APP_MODEL,
),
),
),
],
options = {
options={
"ordering": ["name"],
},
),
@@ -123,7 +123,6 @@ class Migration(migrations.Migration):
),
),
(
"pgh_context",
"pgh_context",
models.ForeignKey(
db_constraint=False,
@@ -216,12 +215,12 @@ class Migration(migrations.Migration):
),
(
"pgh_obj",
models.ForeignKey(
db_constraint=False,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name="events",
to=PARKS_APP_MODEL,
),
),
),
],
options={

View File

@@ -0,0 +1,35 @@
# Generated by Django 5.1.4 on 2025-02-10 09:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pghistory', '0006_delete_aggregateevent'),
('parks', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='parkevent',
name='pgh_context',
field=models.ForeignKey(
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name='+',
to='pghistory.context',
),
),
migrations.AlterField(
model_name='parkareaevent',
name='pgh_context',
field=models.ForeignKey(
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.DO_NOTHING,
related_name='+',
to='pghistory.context',
),
),
]

View File

@@ -36,6 +36,6 @@ urlpatterns = [
path("<slug:park_slug>/transports/", ParkSingleCategoryListView.as_view(), {'category': 'TR'}, name="park_transports"),
path("<slug:park_slug>/others/", ParkSingleCategoryListView.as_view(), {'category': 'OT'}, name="park_others"),
# Include rides URLs with park_slug
path("<slug:park_slug>/rides/", include("rides.urls", namespace="rides")),
# Include park-specific rides URLs
path("<slug:park_slug>/rides/", include("rides.park_urls", namespace="rides")),
]