Django MultiWidget Phone Number Field

后端 未结 4 625
执笔经年
执笔经年 2020-12-31 20:54

I want to create a field for phone number input that has 2 text fields (size 3, 3, and 4 respectively) with the common \"(\" \")\" \"-\" delimiters. Below is my code for th

4条回答
  •  离开以前
    2020-12-31 21:24

    Sometimes it is useful to fix the original problem rather than redoing everything. The error you got, "Caught an exception while rendering: 'NoneType' object is unsubscriptable" has a clue. There is a value returned as None(unsubscriptable) when a subscriptable value is expected. The decompress function in PhoneNumberWidget class is a likely culprit. I would suggest returning [] instead of None.

提交回复
热议问题