@permission_required("core.manage_shop")
def move_attachment(request, id):
    attachment = ProductAttachment.objects.get(pk=id)
    product = attachment.product

    direction = request.GET.get("direction", 0)

    if direction == "1":
        attachment.position += 15
    else:
        attachment.position -= 15
        if attachment.position < 0:
            attachment.position = 10

    attachment.save()

    # Refresh positions
    for i, attachment in enumerate(product.attachments.all()):
        attachment.position = (i + 1) * 10
        attachment.save()

    html = [["#attachments-list", list_attachments(request, product.id, as_string=True)]]

    result = json.dumps({
        "html": html,
    }, cls=LazyEncoder)

    return HttpResponse(result, content_type='application/json')
Returns one of three types of Pomodori entities. A short break, a long
dataset/ETHPy150Open diefenbach/django-lfs/lfs/manage/product/attachments.py/move_attachment--crossover with--dataset/ETHPy150Open Matt-Deacalion/Pomodoro-Calculator/pomodoro_calculator/__init__.py/PomodoroCalculator._get_item