CRM form按field自定义,多选readonly

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 "[email protected]" 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
 
 

猜你喜欢

转载自www.cnblogs.com/venvive/p/11397704.html
CRM