Fix API and admin for location2025

This commit is contained in:
2025-08-30 04:12:55 +09:00
parent 596b7313dd
commit cb399f14bf
3 changed files with 139 additions and 14 deletions

View File

@ -1039,16 +1039,21 @@ class WaypointAdmin(admin.ModelAdmin):
@admin.register(Location2025)
class Location2025Admin(LeafletGeoAdmin):
"""Location2025の管理画面"""
"""Location2025の管理画面(全フィールド対応)"""
list_display = [
'cp_number', 'cp_name', 'event', 'total_point', 'is_active',
'cp_number', 'cp_name', 'event', 'sub_loc_id', 'subcategory',
'total_point', 'has_photos', 'has_videos', 'is_active',
'csv_upload_date', 'created_at'
]
list_filter = [
'event', 'is_active', 'shop_closed', 'shop_shutdown',
'subcategory', 'hidden_location',
'csv_upload_date', 'created_at'
]
search_fields = ['cp_name', 'address', 'description']
search_fields = [
'cp_name', 'address', 'description', 'remark', 'tags',
'sub_loc_id', 'subcategory', 'evaluation_value'
]
readonly_fields = [
'csv_source_file', 'csv_upload_date', 'csv_upload_user',
'created_at', 'updated_at', 'created_by', 'updated_by'
@ -1056,7 +1061,7 @@ class Location2025Admin(LeafletGeoAdmin):
fieldsets = (
('基本情報', {
'fields': ('cp_number', 'event', 'cp_name', 'is_active', 'sort_order')
'fields': ('cp_number', 'event', 'cp_name', 'sub_loc_id', 'subcategory', 'is_active', 'sort_order')
}),
('位置情報', {
'fields': ('latitude', 'longitude', 'location', 'address')
@ -1071,7 +1076,15 @@ class Location2025Admin(LeafletGeoAdmin):
'fields': ('shop_closed', 'shop_shutdown', 'opening_hours')
}),
('詳細情報', {
'fields': ('phone', 'website', 'description')
'fields': ('phone', 'website', 'description', 'remark')
}),
('メディア・タグ情報', {
'fields': ('photos', 'videos', 'tags', 'evaluation_value'),
'classes': ('wide',)
}),
('高度設定', {
'fields': ('hidden_location',),
'classes': ('collapse',)
}),
('CSV情報', {
'fields': ('csv_source_file', 'csv_upload_date', 'csv_upload_user'),
@ -1083,6 +1096,18 @@ class Location2025Admin(LeafletGeoAdmin):
}),
)
def has_photos(self, obj):
"""写真データ有無の表示"""
return bool(obj.photos and obj.photos.strip())
has_photos.boolean = True
has_photos.short_description = '写真'
def has_videos(self, obj):
"""動画データ有無の表示"""
return bool(obj.videos and obj.videos.strip())
has_videos.boolean = True
has_videos.short_description = '動画'
# CSV一括アップロード機能
change_list_template = 'admin/location2025/change_list.html'