mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 14:31:08 -05:00
weird header stuff
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user