; if default_storage.exists(photo_thumbnail_path):
+ default_storage.delete(photo_thumbnail_path)
+ default_storage.save(photo_thumbnail_path, photo)
+
+ group_photo = GroupPhotoInfo.objects.create(
+ group_id=group_id,
+ user_id=user_id,
+ nickname=nickname,
+ photo_path=photo_path,
+ photo_thumbnail_path=photo_thumbnail_path,
+ )
+
+ group_photos = GroupPhotoInfo.objects.filter(
+ group_id=group_id,
+ pk__gt=photo_id,
+ ).order_by(
+ 'created_at'
+ )
+
+ return JsonResponse({
+ 'status': 200,
+ 'message': u'飞图上传成功',
+ 'data': [photo.photo_info for photo in group_photos],
+ })
+
+
class GroupInfoViewSet(viewsets.ModelViewSet):
queryset = GroupInfo.objects.all().order_by('-created_at')
serializer_class = GroupInfoSerializer
@@ -123,7 +123,7 @@ def session_detail_api(request, session): |
||
123 | 123 |
'message': u'获取照片列表成功', |
124 | 124 |
'data': { |
125 | 125 |
'count': photos.count(), |
126 |
- 'photos': [p.detail for p in photos] |
|
126 |
+ 'photos': [p.detail for p in photos], |
|
127 | 127 |
} |
128 | 128 |
}) |
129 | 129 |
|
@@ -144,7 +144,7 @@ def photo_standard_api(request, photo): |
||
144 | 144 |
'status': 200, |
145 | 145 |
'message': u'获取照片详情成功', |
146 | 146 |
'data': { |
147 |
- 'photo': photo.detail |
|
147 |
+ 'photo': photo.detail, |
|
148 | 148 |
} |
149 | 149 |
}) |
150 | 150 |
|