weird header stuff

This commit is contained in:
pacnpal
2024-11-03 22:03:56 +00:00
parent ed585e6a56
commit 07526dcba8
34 changed files with 5047 additions and 185 deletions

View File

@@ -33,27 +33,3 @@ class ParkAreaAdmin(SimpleHistoryAdmin):
# Register the models with their admin classes
admin.site.register(Park, ParkAdmin)
admin.site.register(ParkArea, ParkAreaAdmin)
# Register the historical records for direct editing
from simple_history.models import HistoricalRecords
from .models import Park
class HistoricalParkAdmin(admin.ModelAdmin):
list_display = ('name', 'formatted_location', 'status', 'history_date', 'history_user', 'history_type')
list_filter = ('status', 'history_type')
search_fields = ('name', 'description')
readonly_fields = ('history_date', 'history_type', 'history_id')
def formatted_location(self, obj):
"""Display formatted location string"""
return obj.instance.formatted_location
formatted_location.short_description = 'Location'
def has_add_permission(self, request):
return False # Prevent adding new historical records directly
def has_delete_permission(self, request, obj=None):
return False # Prevent deleting historical records
# Register the historical model
admin.site.register(Park.history.model, HistoricalParkAdmin)