Fix API and admin for location2025
This commit is contained in:
35
rog/admin.py
35
rog/admin.py
@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user