Local Variable referenced before assignment

前端 未结 2 1261
挽巷
挽巷 2020-12-06 08:02

I was wondering if you guys could help. I\'m trying to do a simple view where it sends the user to the client creation form, but I keep getting this error:

2条回答
  •  忘掉有多难
    2020-12-06 08:28

    You almost certainly want to de-indent this part:

    else:
        form = AddClientForm()
    

    That is, on the initial GET of the page, use a blank client form, then when the page is POSTed, use the request POST data to fill in the form object.

提交回复
热议问题