Beispiel #1
0
def index(request):
    if request.method == 'POST':
        f = SoapForm(request.POST)
        soap = f.save()
        return redirect('series:show', soap_id=soap.id)
    soaps = Soap.objects.all()
    return render_to_response(
        'index.html', 
        {
            'soaps':  soaps
        }
    )
Beispiel #2
0
def show(request, soap_id):
    soap = Soap.objects.get(id=soap_id)
    if request.method == 'PUT':
        f = SoapForm(request.POST, instance=soap)
        f.save()
        return redirect('series:show', soap_id=soap_id)
    if request.method == 'DELETE':
        soap.delete()
        return redirect('series:index')
    return render_to_response(
        'show.html', 
        {
            'soap':  soap
        }
    )