How does Django Know the Order to Render Form Fields?

后端 未结 14 1398
不知归路
不知归路 2020-11-28 05:21

If I have a Django form such as:

class ContactForm(forms.Form):
    subject = forms.CharField(max_length=100)
    message = forms.CharField()
    sender = fo         


        
14条回答
  •  無奈伤痛
    2020-11-28 05:51

    It has to do with the meta class that is used in defining the form class. I think it keeps an internal list of the fields and if you insert into the middle of the list it might work. It has been a while since I looked at that code.

提交回复
热议问题