Ejemplo n.º 1
0
def pizzashop_account(request):
    user_form = UserFormForEdit(instance=request.user)
    pizzashop_form = PizzaShopForm(instance=request.user.pizzashop)

    if request.method == "POST":
        user_form = UserFormForEdit(request.POST, instance=request.user)
        pizzashop_form = PizzaShopForm(request.POST, request.FILES, instance=request.user.pizzashop)

        if user_form.is_valid() and pizzashop_form.is_valid():
            user_form.save
            pizzashop_form.save


    return render(request, 'pizzashopapp/account.html', {
        'user_form': user_form,
        'pizzashop_form': pizzashop_form
    })
Ejemplo n.º 2
0
def pizzashop_account(request):
    user_form = UserFormForEdit(instance=request.user)
    pizzashop_form = PizzaShopForm(instance=request.user.Pizzashop)

    if request.method == 'POST':
        user_form = UserFormForEdit(request.POST, instance=request.user)
        pizzashop_form = PizzaShopForm(request.POST, request.FILES, instance=request.user.Pizzashop)
        if user_form.is_valid() and pizzashop_form.is_valid():
            user_form.save()
            pizzashop_form.save()

    context = {
        'user_form': user_form,
        'pizzashop_form': pizzashop_form
    }
    return render(request, 'pizzashop/account.html', context)