okay fine

This commit is contained in:
pacnpal
2024-11-03 17:47:26 +00:00
parent 01c6004a79
commit 27eb239e97
10020 changed files with 1935769 additions and 2364 deletions

31
location/admin.py Normal file
View File

@@ -0,0 +1,31 @@
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')