When I fill out the form, the data stores it correctly in the database, but the form does not work again and the error "too many values to unpack" appears. What can I do?
Here is my template:
<div class="col-md-20 animate-box">
<h3></h3>
<form method="post">{% csrf_token %} {{ form.as_p }}
<div class="form-group">
<input type="submit" value="Enviar" class="btn btn-primary">
</div>
</form>
</div>
My view:
def post(self, request):
form =self.form_class(request.POST)
if form.is_valid():
form.save()
messages.add_message(request, messages.INFO, 'La venta se adiciono correctamente ')
else:
messages.add_message(request, messages.ERROR, 'La venta no se pudo adicionar')
return render(request, 'listar_contratos.html')