def delete(request, card_id): card = Card.get_by_id(int(card_id)) if card is None: raise Http404 card.delete() return HttpResponseRedirect('../..')
def edit(request, card_id): card = Card.get_by_id(int(card_id)) if card is None: raise Http404 if request.method == 'POST': form = CardForm(request.POST, instance=card) if form.is_valid(): logging.info('edit card before %s'% card) form.save(commit=False) logging.info('edit card after %s'% card) card.save() return HttpResponseRedirect('../..') else: form = CardForm(instance=card) return render_to_response('admin/cards_edit.html', RequestContext(request, {'form':form}))