I have the following code to handle a simple form, my view is not sending back an http response.
I can't figure out what's wrong with my code..
def novo_material(request):
current_page='material'
if request.method =='POST':
form = SystemInventoryUpdate(request.POST)
if form.is_valid():
name=form.cleaned_data['name']
qty=form.cleaned_data['qty']
unit=form.cleaned_data['unit']
t= NewMaterial(name=name,qty=qty,unit=unit)
t.save()
return HttpResponseRedirect(reverse('material'))
else:
form=NewMaterial()
return render(request,'novo_material.html',{'form':form})
It is raising this error:
The view dashboard.views.novo_material didn't return an HttpResponse object. It returned None instead.
Aucun commentaire:
Enregistrer un commentaire