Refactor model imports and update admin classes to use pghistory for historical tracking; replace HistoricalModel with TrackedModel in relevant models

This commit is contained in:
pacnpal
2025-02-09 11:20:40 -05:00
parent 7ecf43f1a4
commit b7f6c60682
24 changed files with 1729 additions and 137 deletions

View File

@@ -1,10 +1,13 @@
from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
from django.utils.text import slugify
from .models import Designer
@admin.register(Designer)
class DesignerAdmin(SimpleHistoryAdmin):
class DesignerAdmin(admin.ModelAdmin):
list_display = ('name', 'headquarters', 'founded_date', 'website')
search_fields = ('name', 'headquarters')
list_filter = ('founded_date',)
prepopulated_fields = {'slug': ('name',)}
readonly_fields = ('created_at', 'updated_at')
def get_queryset(self, request):
return super().get_queryset(request).select_related()