Fix image location
This commit is contained in:
15
rog/views.py
15
rog/views.py
@ -2581,9 +2581,13 @@ def get_team_info(request, zekken_number):
|
|||||||
logger.info(f"Found goal record: id={goal_record.id}, goaltime={goal_record.goaltime}")
|
logger.info(f"Found goal record: id={goal_record.id}, goaltime={goal_record.goaltime}")
|
||||||
try:
|
try:
|
||||||
goaltime = goal_record.goaltime
|
goaltime = goal_record.goaltime
|
||||||
if goal_record.goalimage and hasattr(goal_record.goalimage, 'url'):
|
if goal_record.goalimage:
|
||||||
goalimage_url = request.build_absolute_uri(goal_record.goalimage.url)
|
# S3対応のget_image_url関数を使用
|
||||||
|
goalimage_url = get_image_url(goal_record.goalimage)
|
||||||
|
if goalimage_url:
|
||||||
logger.info(f"get_team_info record.goalimage_url={goalimage_url}")
|
logger.info(f"get_team_info record.goalimage_url={goalimage_url}")
|
||||||
|
else:
|
||||||
|
logger.warning(f"Failed to generate URL for goal image")
|
||||||
else:
|
else:
|
||||||
logger.info(f"Goal record exists but no image found: goalimage={goal_record.goalimage}")
|
logger.info(f"Goal record exists but no image found: goalimage={goal_record.goalimage}")
|
||||||
|
|
||||||
@ -2733,9 +2737,12 @@ def get_checkins(request, *args, **kwargs):
|
|||||||
# 画像URLを生成
|
# 画像URLを生成
|
||||||
if checkin_image and checkin_image.checkinimage:
|
if checkin_image and checkin_image.checkinimage:
|
||||||
try:
|
try:
|
||||||
if hasattr(checkin_image.checkinimage, 'url'):
|
# S3対応のget_image_url関数を使用
|
||||||
image_url = request.build_absolute_uri(checkin_image.checkinimage.url)
|
image_url = get_image_url(checkin_image.checkinimage)
|
||||||
|
if image_url:
|
||||||
logger.info(f"Found checkin image for CP {location.cp} (sub_loc_id: {location.sub_loc_id}): {image_url}")
|
logger.info(f"Found checkin image for CP {location.cp} (sub_loc_id: {location.sub_loc_id}): {image_url}")
|
||||||
|
else:
|
||||||
|
logger.warning(f"Failed to generate URL for checkin image CP {location.cp}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Error accessing checkin image for CP {location.cp}: {str(e)}")
|
logger.warning(f"Error accessing checkin image for CP {location.cp}: {str(e)}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user