from django.shortcuts import render, redirect from .forms import GoodsReceptionForm from .models import GoodsReception def goods_reception_list(request): receptions = GoodsReception.objects.all() return render(request, 'goods_reception/goods_reception_list.html', {'receptions': receptions}) def goods_reception_create(request): if request.method == 'POST': form = GoodsReceptionForm(request.POST) if form.is_valid(): form.save() return redirect('goods_reception_list') else: form = GoodsReceptionForm() return render(request, 'goods_reception/goods_reception_form.html', {'form': form})