Esempio n. 1
0
def edit_account_bank(request, bankID):
    current = get_object_or_404(AccountBank, pk=bankID, owner=request.user)

    if request.method == 'POST':
        form = AccountBankForm(request.POST, instance=current)
        if form.is_valid():
            bank = form.save()
            return HttpResponseRedirect('/profile/e/edit')
    else:
        form = AccountBankForm(instance=current)
    return render_to_response('profile/newAccountBank.html', {'form':form},
        context_instance=RequestContext(request))
Esempio n. 2
0
def new_account_bank(request):
    if request.method == 'POST':
        form = AccountBankForm(request.POST)
        if form.is_valid():
            newAccountBank = form.save(commit=False)
            newAccountBank.owner = request.user
            newAccountBank.save()
            request.user.profile.banks.add(newAccountBank)
            return HttpResponseRedirect('/profile/e/edit')
    else:
        form = AccountBankForm()
    return render_to_response('profile/newAccountBank.html', {'form' : form }, 
        context_instance=RequestContext(request))
Esempio n. 3
0
def edit_account_bank(request, bankID):
    current = get_object_or_404(AccountBank, pk=bankID, owner=request.user)

    if request.method == 'POST':
        form = AccountBankForm(request.POST, instance=current)
        if form.is_valid():
            bank = form.save()
            return HttpResponseRedirect('/profile/e/edit')
    else:
        form = AccountBankForm(instance=current)
    return render_to_response('profile/newAccountBank.html', {'form': form},
                              context_instance=RequestContext(request))
Esempio n. 4
0
def new_account_bank(request):
    if request.method == 'POST':
        form = AccountBankForm(request.POST)
        if form.is_valid():
            newAccountBank = form.save(commit=False)
            newAccountBank.owner = request.user
            newAccountBank.save()
            request.user.profile.banks.add(newAccountBank)
            return HttpResponseRedirect('/profile/e/edit')
    else:
        form = AccountBankForm()
    return render_to_response('profile/newAccountBank.html', {'form': form},
                              context_instance=RequestContext(request))