Найти - Пользователи
Полная версия: inlineformset_factory, как поставить атрибут required fields
Начало » Django » inlineformset_factory, как поставить атрибут required fields
1
eboome
здраствуйте! такая ситуация:
есть формсет:
class SecretQuestionsFormSetForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(SecretQuestionsFormSetForm, self).__init__(*args, **kwargs)
        self.fields['question'].error_messages={'required': _('Please, choose the question!')}
        self.fields['answer'].error_messages={'required': _('Please, answer the question!')}
    
SecretQuestionsForm = inlineformset_factory(Profiles, SecretQuestions, extra=3,can_delete=False, fields=('question', 'answer'))
как сделать так что б все поля были обьязательни для ввода?
FishHook
Задать им свойство required=True
eboome
inlineformset_factory() got an unexpected keyword argument ‘required’
FishHook
то есть во так не работает???
 def __init__(self, *args, **kwargs):
        super(SecretQuestionsFormSetForm, self).__init__(*args, **kwargs)
        self.fields['question'].required = True
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB