Change Location2025 columns
This commit is contained in:
25
rog/admin.py
25
rog/admin.py
@ -1044,8 +1044,8 @@ class WaypointAdmin(admin.ModelAdmin):
|
||||
class Location2025Admin(LeafletGeoAdmin):
|
||||
"""Location2025の管理画面(全フィールド対応)"""
|
||||
list_display = [
|
||||
'cp_number', 'cp_name', 'event', 'sub_loc_id', 'subcategory',
|
||||
'total_point', 'has_photos', 'has_videos', 'is_active',
|
||||
'cp_number', 'cp_name', 'event', 'sub_loc_id', 'evaluation_value_display',
|
||||
'checkin_radius_display', 'total_point', 'has_photos', 'has_videos', 'is_active',
|
||||
'csv_upload_date', 'created_at'
|
||||
]
|
||||
list_filter = [
|
||||
@ -1112,6 +1112,27 @@ class Location2025Admin(LeafletGeoAdmin):
|
||||
has_videos.boolean = True
|
||||
has_videos.short_description = '動画'
|
||||
|
||||
def evaluation_value_display(self, obj):
|
||||
"""evaluation_valueのカスタム表示"""
|
||||
evaluation_map = {
|
||||
'0': '通常CP',
|
||||
'1': '買物CP',
|
||||
'2': 'QR-CP'
|
||||
}
|
||||
value = str(obj.evaluation_value or '0')
|
||||
return evaluation_map.get(value, value)
|
||||
evaluation_value_display.short_description = 'CP種別'
|
||||
|
||||
def checkin_radius_display(self, obj):
|
||||
"""checkin_radiusのカスタム表示"""
|
||||
if obj.checkin_radius == -1:
|
||||
return '要タップ'
|
||||
elif obj.checkin_radius is not None and obj.checkin_radius >= 0:
|
||||
return f'{obj.checkin_radius}m'
|
||||
else:
|
||||
return '-'
|
||||
checkin_radius_display.short_description = 'チェックイン範囲'
|
||||
|
||||
# CSV一括アップロード機能
|
||||
change_list_template = 'admin/location2025/change_list.html'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user