Refactor test utilities and enhance ASGI settings

- 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.
This commit is contained in:
pacnpal
2025-08-20 19:51:59 -04:00
parent 69c07d1381
commit 66ed4347a9
230 changed files with 15094 additions and 11578 deletions

View File

@@ -1,17 +1,14 @@
from django.contrib.gis.db import models
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from django.core.validators import MinValueValidator, MaxValueValidator
class ParkLocation(models.Model):
"""
Represents the geographic location and address of a park, with PostGIS support.
"""
park = models.OneToOneField(
'parks.Park',
on_delete=models.CASCADE,
related_name='location'
"parks.Park", on_delete=models.CASCADE, related_name="location"
)
# Spatial Data
@@ -19,14 +16,14 @@ class ParkLocation(models.Model):
srid=4326,
null=True,
blank=True,
help_text="Geographic coordinates (longitude, latitude)"
help_text="Geographic coordinates (longitude, latitude)",
)
# Address Fields
street_address = models.CharField(max_length=255, blank=True)
city = models.CharField(max_length=100, db_index=True)
state = models.CharField(max_length=100, db_index=True)
country = models.CharField(max_length=100, default='USA')
country = models.CharField(max_length=100, default="USA")
postal_code = models.CharField(max_length=20, blank=True)
# Road Trip Metadata
@@ -40,7 +37,7 @@ class ParkLocation(models.Model):
osm_type = models.CharField(
max_length=10,
blank=True,
help_text="Type of OpenStreetMap object (node, way, or relation)"
help_text="Type of OpenStreetMap object (node, way, or relation)",
)
@property
@@ -72,7 +69,7 @@ class ParkLocation(models.Model):
self.city,
self.state,
self.postal_code,
self.country
self.country,
]
return ", ".join(part for part in address_parts if part)
@@ -109,7 +106,7 @@ class ParkLocation(models.Model):
class Meta:
verbose_name = "Park Location"
verbose_name_plural = "Park Locations"
ordering = ['park__name']
ordering = ["park__name"]
indexes = [
models.Index(fields=['city', 'state']),
]
models.Index(fields=["city", "state"]),
]