... d ( validators = [ validate_even ]) より複雑なバリデータに対しては、クラスで __call__() メソッドを利用することもできます。 RegexValidator はその一例で、このテクニックを使っています。クラスベースのバリデータが validators モデルフィールドのオプション内で ... ますが、作成したフィールドで使用することもできます。 追加で使うことも、 field.clean() メソッドの代わりに使うことも可能です。 RegexValidator class RegexValidator ( regex = None , message = None , code = None , inverse_match = None , flags = 0 ) [ソース] ... パラメータ : regex -- None 以外の場合、 regex をオーバーライドします。正規表現の文字列か、コンパイル済みの正規表現を指定します。 message -- N ... ... min check crash when using a query expression in ModelAdmin.ordering ( #29428 ). Fixed __regex and __iregex lookups with MySQL 8 ( #29451 ). Fixed migrations crash with namespace packages on Python 3.7 ( #28814 ). ... ... escapes leading slashes to prevent redirects to other domains. バグ修正 Fixed a regression in Django 2.0.7 that broke the regex lookup on MariaDB (even though MariaDB isn't officially supported) ( #29544 ). Fixed a regression where django.template.Te ... ... sing reverse() Django's URL handling is based on a mapping of regex patterns (representing the URLs) to callable views, and Django's own processing consists of matching a requested URL again ... ... ... mapping of regex patterns (representing the URLs) to callable views, and Django's own processing consists of matching a requested URL again ... ... ラス) Coalesce (django.db.models.functions のクラス) code (EmailValidator の属性) (ProhibitNullCharactersValidator の属性) (RegexValidator の属性) codename (models.Permission の属性) coerce (TypedChoiceField の属性) Collate (django.db.models.functions ... has_key hstorefield.has_keys hstorefield.key hstorefield.keys hstorefield.values icontains iendswith iexact in intersects iregex isempty isnull iso_week_day iso_year istartswith isvalid jsonfield.contained_by jsonfield.contains jsonfield.has_any_keys ... inf rangefield.not_gt rangefield.not_lt rangefield.overlap rangefield.startswith rangefield.upper_inc rangefield.upper_inf regex relate right same_as search second startswith strictly_above strictly_below time touches trigram_similar trigram_strict_wo ... ... 雑なマッチング要件については、独自のパスコンバータを定義できます。 コンバーターとは、以下のようなクラスです: 文字列としての regex クラス属性を持ちます。 to_python(self, value) メソッドで、マッチした文字列をビュー関数に渡す型に変換します。与えられた値を ... Error はマッチしないと解釈され、結果として reverse() は NoReverseMatch を発生させます。 例: class FourDigitYearConverter : regex = "[0-9] {4} " def to_python ( self , value ): return int ( value ) def to_url ( self , value ): return " %04d " % value r ... ... アップを使用する必要があります。 注釈 キーのトランスフォームは、 contains 、 icontains 、 endswith 、 iendswith 、 iexact 、 regex 、 iregex 、 startswith 、および istartswith ルックアップとも連結できます。 警告 どのような文字列でも hstore 値のキーになり ... ... 用できます。 NullBooleanField ( widget = Select ( choices = [ ( "" , "Unknown" ), ( True , "Yes" ), ( False , "No" ), ] ) ) RegexField class RegexField ( ** kwargs ) [ソース] デフォルトのウィジェット: TextInput 空の値: empty_value として指定したものです ... 。 正規化後の値: 文字列になります。 RegexValidator を使用して、与えられた値が特定の正規表現と一致するかどうかを検証します。 エラーメッセージのキー: required 、 inva ... lid 1つの必須引数を取ります: regex 文字列またはコンパイルされた正規表現オブジェクトとして指定される正規表現。 max_length 、 min_length 、 strip 、および empt ... 2026年10月08日