Crispy Form VariableDoesNotExist on Django

前端 未结 2 745
执笔经年
执笔经年 2021-01-05 05:15

For crispy form on Django, I keep getting VariableDoesNotExist at / Failed lookup for key [form] in u\'[{\\\'False\\\': False, \\\'None\\\': None,.....<

2条回答
  •  不知归路
    2021-01-05 05:59

    I came across the VariableDoesNotExist problem as well with Failed lookup for key [form], but for me the problem was that I mistakenly used generic.DetailView as base class instead of generic.UpdateView.

    Changing to UpdateView fixed the problem.

    class MyUpdateView(generic.UpdateView):
    
        template_name = "object_update.html"
        model = MyModel
        form_class = MyCreateForm
    

提交回复
热议问题