Пример #1
0
def photo_detail(request, project_id, photo_id):
    if not request.GET.get('ajax'):
        return project_overview(request, project_id)

    photo = Photo.objects.get(id=photo_id)
    info = get_exif(photo.fullurl()[1:])
    if info:
        dt = info.get('DateTime') or info.get('DateTimeOriginal') or info.get(
            'DateTimeDigitized')
        if dt:
            dt = datetime.strptime(dt, '%Y:%m:%d %H:%M:%S')
        else:
            dt = None
    else:
        dt = None

    # Mode
    mode = project_getmode_helper(request, project_id)
    is_view_mode = mode == 'view'

    return object_detail(request,
                         Photo.objects.all(),
                         object_id=photo_id,
                         template_object_name='photo',
                         template_name='stockphoto/photo_detail.html',
                         extra_context={
                             'project_id': project_id,
                             'datetime': dt,
                             'is_view_mode': is_view_mode
                         })
Пример #2
0
def photo_detail(request, project_id, photo_id):
    if not request.GET.get('ajax'):
        return project_overview(request, project_id)

    photo = Photo.objects.get(id=photo_id)
    info = get_exif(photo.fullurl()[1:])
    if info:
        dt = info.get('DateTime') or info.get('DateTimeOriginal') or info.get('DateTimeDigitized')
        if dt:
            dt = datetime.strptime(dt, '%Y:%m:%d %H:%M:%S')
        else:
            dt = None
    else:
        dt = None

    # Mode
    mode = project_getmode_helper(request, project_id)
    is_view_mode = mode == 'view'

    return object_detail(
        request, 
        Photo.objects.all(), 
        object_id=photo_id,
        template_object_name='photo', 
        template_name='stockphoto/photo_detail.html',
        extra_context={'project_id': project_id, 'datetime': dt, 'is_view_mode': is_view_mode}
    )
Пример #3
0
def gallery_list(request, project_id):
    if 'HTTP_X_FILE_NAME' in request.META:
        return photo_add(request, project_id, None)
    elif not request.GET.get('ajax'):
        return project_overview(request, project_id)
    # Mode
    mode = project_getmode_helper(request, project_id)
    is_view_mode = mode == 'view'

    return object_list(
        request, 
        Gallery.objects.filter(project__id=project_id).order_by('-id'), 
        template_object_name='gallery', 
        template_name='stockphoto/gallery_list.html',
        paginate_by=15,
        extra_context={'project_id': project_id, 'is_view_mode': is_view_mode}
    )
Пример #4
0
def gallery_list(request, project_id):
    if 'HTTP_X_FILE_NAME' in request.META:
        return photo_add(request, project_id, None)
    elif not request.GET.get('ajax'):
        return project_overview(request, project_id)
    # Mode
    mode = project_getmode_helper(request, project_id)
    is_view_mode = mode == 'view'

    return object_list(
        request,
        Gallery.objects.filter(project__id=project_id).order_by('-id'),
        template_object_name='gallery',
        template_name='stockphoto/gallery_list.html',
        paginate_by=15,
        extra_context={
            'project_id': project_id,
            'is_view_mode': is_view_mode
        })
Пример #5
0
def gallery_detail(request, project_id, gallery_id):
    if 'HTTP_X_FILE_NAME' in request.META:
        return photo_add(request, project_id, gallery_id)
    elif not request.GET.get('ajax'):
        return project_overview(request, project_id)
    # Mode
    mode = project_getmode_helper(request, project_id)
    is_view_mode = mode == 'view'

    plan_tags_form = utility.plan_tags_form(project_id, Gallery.objects.get(id=gallery_id), 10)

    return object_detail(
        request, 
        Gallery.objects.all(), 
        object_id=gallery_id,
        template_object_name='gallery', 
        template_name='stockphoto/gallery_detail.html',
        extra_context={'project_id': project_id, 'is_view_mode': is_view_mode, 'plan_tags_form':plan_tags_form}
    )
Пример #6
0
def gallery_detail(request, project_id, gallery_id):
    if 'HTTP_X_FILE_NAME' in request.META:
        return photo_add(request, project_id, gallery_id)
    elif not request.GET.get('ajax'):
        return project_overview(request, project_id)
    # Mode
    mode = project_getmode_helper(request, project_id)
    is_view_mode = mode == 'view'

    plan_tags_form = utility.plan_tags_form(project_id,
                                            Gallery.objects.get(id=gallery_id),
                                            10)

    return object_detail(request,
                         Gallery.objects.all(),
                         object_id=gallery_id,
                         template_object_name='gallery',
                         template_name='stockphoto/gallery_detail.html',
                         extra_context={
                             'project_id': project_id,
                             'is_view_mode': is_view_mode,
                             'plan_tags_form': plan_tags_form
                         })