Пример #1
0
def admin_add_image(request, uid):
    if request.method == 'POST':
        showcase = Showcase.get_by_id(uid)
        if not showcase:
            return render_to_response('empty.html')
        upload_files = get_uploads(request, 'file')
        if len(upload_files):
            blob_info = upload_files[0]
            if blob_info.size:
                image = ShowcaseImage(showcase_key=showcase.key(),
                    image_key=str(blob_info.key()))
                image.cached_url = image.get_cached_url()
                image.put()
            else:
                 blob_info.delete()
        return admin_images(request, uid)
    return render_to_response('empty.html')
Пример #2
0
def admin_delete_image(request, uid):
    if request.method == 'POST':
        img = ShowcaseImage.get_by_id(uid)
        if img:
            img.delete()
    return render_to_response('empty.html')