Пример #1
0
def upload_image(request, roomid):
    """Controller for uploading an image"""

    room = get_object_or_404(Room, pk=roomid)
    navpath = get_path() + [
        (room.id, reverse('room-info', kwargs={'roomid': room.id})),
        ('Edit images',)
    ]

    if request.method == 'POST':
        _logger.debug('Uploading images')
        handle_image_upload(request, room=room)
        return redirect("room-info-upload", roomid=room.id)

    return render_to_response("info/room/upload.html",
                              {"object": room, "room": room, "navpath": navpath,
                               "title": create_title(navpath)},
                              context_instance=RequestContext(request))
Пример #2
0
def upload_image(request, locationid):
    """Controller for uploading an image"""

    location = get_object_or_404(Location, pk=locationid)
    navpath = get_path() + [(location.id,
                             reverse('location-info',
                                     kwargs={'locationid': location.id})),
                            ('Edit images', )]

    if request.method == 'POST':
        _logger.debug('Uploading images')
        handle_image_upload(request, location=location)
        return redirect("location-info-upload", locationid=location.id)

    return render(request, "info/location/upload.html", {
        "object": location,
        "navpath": navpath,
        "title": create_title(navpath)
    })