mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 06:11:07 -05:00
okay fine
This commit is contained in:
31
location/admin.py
Normal file
31
location/admin.py
Normal 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')
|
||||
Reference in New Issue
Block a user