def delete_thumb(request, thumb_key): thumb = ThumbImage.get(thumb_key) if thumb: gift = thumb.gift thumb.delete() if gift.thumbs.count() and not gift.main_thumb.count(): tmp_thumb = gift.thumbs[0] tmp_thumb.main_gift = gift tmp_thumb.put() return redirect('/gift/admin/edit/%s/' % gift.key()) return redirect('/admin/view_all/')
def set_default_thumb(request, gift, key): thumb = ThumbImage.get(key) if thumb: gift_obj = Gift.get(gift) if gift_obj: if gift_obj.main_thumb.count(): for old_thumb in gift_obj.main_thumb: old_thumb.main_gift = None old_thumb.put() thumb.main_gift = gift_obj thumb.put() return redirect('/gift/admin/edit/%s/' % gift)
def delete_thumb(request, key): thumb = ThumbImage.get(key) if thumb: thumb.delete() return redirect('/img/admin/view_all/')