| 123456789101112131415161718192021222324252627 | 
              - import itertools
 - from group.models import GroupPhotoInfo
 - def get_current_photos(group_id, user_id, current_id):
 -     
 -     group_photos = GroupPhotoInfo.objects.filter(
 -         group_id=group_id,
 -         status=True,
 -         pk__gt=current_id,
 -     ).order_by(
 -         '-session_id',
 -         '-pk'
 -     )
 -     
 -     latest_photo = group_photos.first()
 -     
 -     group_photos = map(lambda x: {'session_id': x[0], 'photos': [y.photo_info(user_id) for y in x[1]]},
 -                        itertools.groupby(group_photos, lambda x: x.session_id))
 -     return {
 -         'current_id': latest_photo and latest_photo.pk or current_id,
 -         'photos': group_photos,
 -     }
 
 
  |