[Fixed]-UnboundLocalError at /vnos/

1👍

Your else statement is indented too far. Move it back one level.

Two other points: you should be getting the data from the form after validation, not direct from the POST:

    amount = form.cleaned_data['amount']
    cost = form.cleaned_data['cost']

And secondly, you could make it even simpler by using a ModelForm.

Leave a comment