Supervisor update 2
This commit is contained in:
BIN
rog/.serializers.py.swp
Normal file
BIN
rog/.serializers.py.swp
Normal file
Binary file not shown.
BIN
rog/.urls.py.swp
Normal file
BIN
rog/.urls.py.swp
Normal file
Binary file not shown.
BIN
rog/.views.py.swp
Normal file
BIN
rog/.views.py.swp
Normal file
Binary file not shown.
@ -11,10 +11,11 @@ from .views import TestActionViewSet
|
||||
|
||||
from .views import OwnerEntriesView, OwnerTeamsView, OwnerMembersView
|
||||
|
||||
from django.urls import path
|
||||
from . import views
|
||||
#from .views import NewEvent2AdminView
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register(r'newevent2', views.NewEvent2ViewSet)
|
||||
@ -124,3 +125,7 @@ urlpatterns += [
|
||||
# for Supervisor Web app
|
||||
path('test/', views.test_api, name='test_api'),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
# 開発環境でのメディアファイル提供
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
20
rog/views.py
20
rog/views.py
@ -88,6 +88,7 @@ import xlsxwriter
|
||||
from io import BytesIO
|
||||
|
||||
from django.urls import get_resolver
|
||||
import os
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -2381,6 +2382,19 @@ def get_team_info(request, zekken_number):
|
||||
|
||||
team = Team.objects.get(id=self.kwargs['team_id'])
|
||||
|
||||
def get_image_url(image_path):
|
||||
"""画像URLを生成する補助関数"""
|
||||
if not image_path:
|
||||
return None
|
||||
|
||||
# 開発環境用のパス生成
|
||||
if settings.DEBUG:
|
||||
return os.path.join(settings.MEDIA_URL, str(image_path))
|
||||
|
||||
# 本番環境用のパス生成
|
||||
return f"{settings.MEDIA_URL}{image_path}"
|
||||
|
||||
|
||||
@api_view(['GET'])
|
||||
def get_checkins(request, *args, **kwargs):
|
||||
#def get_checkins(request, zekken_number, event_code):
|
||||
@ -2437,14 +2451,14 @@ def get_checkins(request, *args, **kwargs):
|
||||
'points': c.points or 0,
|
||||
'buy_flag': c.buy_flag,
|
||||
'photos': location.photos if location else None,
|
||||
'image_address': c.image_address,
|
||||
'receipt_address': c.image_receipt,
|
||||
'image_address': get_image_url(c.image_address),
|
||||
'receipt_address': get_image_url(c.image_receipt),
|
||||
'location_name': location.location_name if location else None,
|
||||
'checkin_point': location.checkin_point if location else None,
|
||||
'buy_point': location.buy_point
|
||||
})
|
||||
|
||||
logger.debug(f"data={data}")
|
||||
#logger.debug(f"data={data}")
|
||||
return Response(data)
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user