コード例 #1
0
ファイル: lists.py プロジェクト: engmohy90/sowarstock
    def __init__(self, base_field, size=None, **kwargs):
        self.base_field = base_field
        self.size = size

        super(ListFieldMixin, self).__init__(**kwargs)

        if self.size:
            self.validators.append(ListMaxLengthValidator(int(self.size)))
コード例 #2
0
 def __init__(self, base_field, max_length=None, min_length=None, *args, **kwargs):
     self.base_field = base_field
     super(SimpleListField, self).__init__(*args, **kwargs)
     if max_length is not None:
         self.max_length = max_length
         self.validators.append(ListMaxLengthValidator(int(max_length)))
     if min_length is not None:
         self.min_length = min_length
         self.validators.append(ListMinLengthValidator(int(min_length)))
コード例 #3
0
ファイル: lists.py プロジェクト: timgates42/django-mysql
    def __init__(self,
                 base_field: Field,
                 size: int | None = None,
                 **kwargs: Any) -> None:
        self.base_field = base_field
        self.size = size

        super().__init__(**kwargs)

        if self.size:
            self.validators.append(ListMaxLengthValidator(int(self.size)))
コード例 #4
0
 def __init__(
     self,
     base_field: forms.Field,
     max_length: int | None = None,
     min_length: int | None = None,
     *args: Any,
     **kwargs: Any,
 ) -> None:
     self.base_field = base_field
     super().__init__(*args, **kwargs)
     if max_length is not None:
         self.max_length = max_length
         self.validators.append(ListMaxLengthValidator(int(max_length)))
     if min_length is not None:
         self.min_length = min_length
         self.validators.append(ListMinLengthValidator(int(min_length)))