feat: Implement initial schema and add various API, service, and management command enhancements across the application.

This commit is contained in:
pacnpal
2026-01-01 15:13:01 -05:00
parent c95f99ca10
commit b243b17af7
413 changed files with 11164 additions and 17433 deletions

View File

@@ -156,7 +156,6 @@ class ParkLocationAdmin(QueryOptimizationMixin, GISModelAdmin):
"description": "OpenStreetMap identifiers for data synchronization.",
},
),
)
@admin.display(description="Park")
@@ -358,9 +357,7 @@ class ParkAdmin(
for park in queryset:
# Statistics are auto-calculated, so just touch the record
park.save(update_fields=["updated_at"])
self.message_user(
request, f"Successfully recalculated statistics for {queryset.count()} parks."
)
self.message_user(request, f"Successfully recalculated statistics for {queryset.count()} parks.")
def get_actions(self, request):
"""Add custom actions to the admin."""
@@ -482,9 +479,7 @@ class CompanyHeadquartersInline(admin.StackedInline):
)
class CompanyHeadquartersAdmin(
QueryOptimizationMixin, TimestampFieldsMixin, BaseModelAdmin
):
class CompanyHeadquartersAdmin(QueryOptimizationMixin, TimestampFieldsMixin, BaseModelAdmin):
"""
Admin interface for standalone CompanyHeadquarters management.
@@ -661,7 +656,7 @@ class CompanyAdmin(
color = colors.get(role, "#6c757d")
badges.append(
f'<span style="background-color: {color}; color: white; '
f'padding: 2px 6px; border-radius: 3px; font-size: 10px; '
f"padding: 2px 6px; border-radius: 3px; font-size: 10px; "
f'margin-right: 4px;">{role}</span>'
)
return format_html("".join(badges))
@@ -702,9 +697,7 @@ class CompanyAdmin(
"""Refresh park count statistics for selected companies."""
for company in queryset:
company.save(update_fields=["updated_at"])
self.message_user(
request, f"Successfully updated counts for {queryset.count()} companies."
)
self.message_user(request, f"Successfully updated counts for {queryset.count()} companies.")
def get_actions(self, request):
"""Add custom actions to the admin."""
@@ -840,12 +833,8 @@ class ParkReviewAdmin(QueryOptimizationMixin, ExportActionMixin, BaseModelAdmin)
"""Display moderation status with color coding."""
if obj.moderated_by:
if obj.is_published:
return format_html(
'<span style="color: green; font-weight: bold;">Approved</span>'
)
return format_html(
'<span style="color: red; font-weight: bold;">Rejected</span>'
)
return format_html('<span style="color: green; font-weight: bold;">Approved</span>')
return format_html('<span style="color: red; font-weight: bold;">Rejected</span>')
return format_html('<span style="color: orange;">Pending</span>')
def save_model(self, request, obj, form, change):