Advertisement
DigitalMag

label_classes

Dec 31st, 2018
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. #ничего не делает:
  2.  
  3. class CreatePerson(forms.ModelForm):
  4.  
  5.     def __init__(self, *args, **kwargs):
  6.  
  7.         super(CreatePerson, self).__init__(*args, **kwargs)      
  8.         self.fields['email'].label_classes = ('label_cls',)        
  9.         self.fields['email'].validators=[EmailValidator(message="Некорректный адрес электронной почты")]
  10.  
  11. #если так, то "'CreatePerson' object has no attribute 'fields'":
  12.  
  13. class CreatePerson(forms.ModelForm):
  14.  
  15.     def __init__(self, *args, **kwargs):
  16.  
  17.         self.fields['email'].label_classes = ('label_cls',)
  18.         super(CreatePerson, self).__init__(*args, **kwargs)            
  19.         self.fields['email'].validators=[EmailValidator(message="Некорректный адрес электронной почты")]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement