CRM form按field自定义,多选readonly

[亡魂溺海] 提交于 2019-11-28 06:42:27

1、form按field自定义

官方文档上:https://docs.djangoproject.com/zh-hans/2.1/ref/forms/validation/写着可以用字段名

from django import forms

class ContactForm(forms.Form):
    # Everything as before.
    ...

    def clean_recipients(self):
        data = self.cleaned_data['recipients']
        if "fred@example.com" not in data:
            raise forms.ValidationError("You have forgotten about Fred!")

        # Always return a value to use as the new cleaned data, even if
        # this method didn't change it.
        return data
 

 

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