mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 17:51:08 -05:00
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
from django.contrib import admin
|
|
from django.contrib.contenttypes.admin import GenericTabularInline
|
|
from .models import Location
|
|
|
|
@admin.register(Location)
|
|
class LocationAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'location_type', 'city', 'state', 'country')
|
|
list_filter = ('location_type', 'country', 'state', 'city')
|
|
search_fields = ('name', 'street_address', 'city', 'state', 'country')
|
|
readonly_fields = ('created_at', 'updated_at')
|
|
fieldsets = (
|
|
('Basic Information', {
|
|
'fields': ('name', 'location_type')
|
|
}),
|
|
('Geographic Coordinates', {
|
|
'fields': ('latitude', 'longitude')
|
|
}),
|
|
('Address', {
|
|
'fields': ('street_address', 'city', 'state', 'country', 'postal_code')
|
|
}),
|
|
('Content Type', {
|
|
'fields': ('content_type', 'object_id')
|
|
}),
|
|
('Metadata', {
|
|
'fields': ('created_at', 'updated_at'),
|
|
'classes': ('collapse',)
|
|
})
|
|
)
|
|
|
|
def get_queryset(self, request):
|
|
return super().get_queryset(request).select_related('content_type')
|