Validating a form with overloaded _init_

橙三吉。 提交于 2019-12-02 08:25:30

You've changed the signature to the form initialization, so that the first parameters is now Grid_Type rather than the usual data. This means that when you do form = Isochrone_Set_Parameters(request.POST), the POST is being used for Grid_Type.

Either make sure you always pass Grid_Type, or (preferably) don't put that in the parameter list at all: get it from kwargs:

def __init__(self, *args, **kwargs):
    Grid_Type = kwargs.pop('Grid_Type', None)
    super(Isochrone_Set_Parameters, self).__init__(*args, **kwargs)
    ...

(Also, please use PEP8-standard naming conventions: IsochroneSetParameters, grid_type, etc).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!