... )。各バージョン系列の最新リリースのみを公式にサポートし、最新リリースを使用することを 強く推奨 します。 Django 3.2 の新機能 Automatic AppConfig discovery Most pluggable applications define an AppConfig subclass in an apps.py submodule. Many define a d ... _init__.py . When the apps.py submodule exists and defines a single AppConfig subclass, Django now uses that configuration automatically, so you can remove default_app_config . default_app_config made it possible to declare only the application's pat ... atibility with the former style, with the intent to switch the ecosystem to the latter, but the switch didn't happen. With automatic AppConfig discovery, default_app_config is no longer needed. As a consequence, it's deprecated. See アプリケーションを ... ... url = forms . URLField () ... comment = forms . CharField () ... >>> f = CommentForm ( initial = { "name" : "instance" }, auto_id = False ) >>> print ( f ) <div>Name:<input type="text" name="name" value="instance" required></div> <div>Url:<input typ ... ctForm インスタンスに影響を与えます。 >>> f . base_fields [ "subject" ] . label_suffix = "?" >>> another_f = ContactForm ( auto_id = False ) >>> another_f . as_div () . split ( "</div>" )[ 0 ] '<div><label for="id_subject">Subject?</label><input type ... さらにフォーム行のレンダリングをカスタマイズすることができます。 フォーム要素の HTML id 属性と <label> タグを設定する Form. auto_id デフォルトでは、フォームをレンダリングするメソッドは次のものを含みます: フォーム要素に対する HTML id 属性。 ラベルの前後 ... ... イドを参照してください。 自動インポートをカスタマイズする shell 管理コマンドの自動インポート動作をカスタマイズするには、 get_auto_imports() メソッドをオーバーライドします。このメソッドは、アプリケーションで利用可能なオブジェクトまたはモジュールのインポ ... /management/commands/shell.py from django.core.management.commands import shell class Command ( shell . Command ): def get_auto_imports ( self ): return super () . get_auto_imports () + [ "django.urls.reverse" , "django.urls.resolve" , ] The customiz ... mport. このようにカスタムした shell コマンドを verbosity=2 を付けて実行すると、次のように表示されます: 13 objects imported automatically: from django.db import connection, reset_queries, models from django.conf import settings from django.contrib.adm ... ... ib.postgres The new Lexeme expression for full text search provides fine-grained control over search terms. Lexeme objects automatically escape their input and support logical combination operators ( & , | , ~ ), prefix matching, and term weighting. ... mands now create the custom target directory if it doesn't exist. Common utilities, such as django.conf.settings , are now automatically imported to the shell by default. マイグレーション Squashed migrations can now themselves be squashed before bein ... ficantly, closely examine any custom subclasses that rely on overriding undocumented, internal underscore methods. DEFAULT_AUTO_FIELD setting now defaults to BigAutoField Since Django 3.2, when the DEFAULT_AUTO_FIELD setting was added, the default st ... ... o 2.2.1 where SearchVector generates SQL with a redundant Coalesce call ( #30488 ). Fixed a regression in Django 2.2 where auto-reloader doesn't detect changes in manage.py file when using StatReloader ( #30479 ). Fixed crash of ArrayAgg and StringAg ... g with ordering argument when used in a Subquery ( #30315 ). Fixed a regression in Django 2.2 that caused a crash of auto-reloader when an exception with custom signature is raised ( #30516 ). Fixed a regression in Django 2.2.1 where auto-reloa ... ... どのフィールドにも primary_key=True を設定する必要はありません。自動作成される主キーの型は、アプリ単位では AppConfig.default_auto_field 、グローバルには DEFAULT_AUTO_FIELD 設定で指定できます。詳しくは 自動インクリメントの主キーフィールド を参照してくだ ... ース] このフィールドに対して実行するバリデータのリスト。詳細は バリデータのドキュメント を参照してください。 フィールドの型 AutoField class AutoField ( ** options ) [ソース] 利用可能な ID に応じて、自動的にインクリメントする IntegerField です。通常は直 ... ない場合は、主キーのフィールドが自動的にモデルに追加されます。 自動インクリメントの主キーフィールド も参照してください。 BigAutoField class BigAutoField ( ** options ) [ソース] 64 ビットの数値です。 1 から 9223372036854775807 までの数を扱える以外は、 ... ... から、 makemigrations を実行してください。 $ python manage.py makemigrations Migrations for 'books' : books/migrations/0003_auto.py: ~ Alter field author on book すると、あなたが書いたモデルがスキャンされ、現在のバージョンのマイグレーションファイルに記 ... ます: $ python manage.py migrate Operations to perform: Apply all migrations: books Running migrations: Applying books.0003_auto... OK マイグレーションを適用したら、マイグレーションとモデルの変更をバージョン管理システムに1つのコミットとしてコミットしま ... are using, since Django tailors the SQL to it. Database-specific field types and the quoting of names are handled for you automatically. The example above is generated for PostgreSQL. Table names are automatically generated by combining the name of ... ... ded settings while the Windows colorama library was installed ( #32740 ). Fixed a bug in Django 3.2 that would trigger the auto-reloader for template changes when directory paths were specified with strings ( #32744 ). Fixed a regression in Django 3. ... 2 that caused a crash of auto-reloader with AttributeError , e.g. inside a Conda environment ( #32783 ). Fixed a regression in Django 3.2 that caused a ... ... meRangeField , if the right hand side of an expression is the same type ( #30621 ). Fixed a regression in Django 2.2 where auto-reloader crashes if a file path contains null characters ( '\x00' ) ( #30506 ). Fixed a regression in Django 2.2 where aut ... ... 文字です。 注釈 多くのDjangoのモデルフィールドは、受け取ってもなにも起こらないオプションを受け取ります。例えば、 editable と auto_now は django.db.models.DateField に渡すことができますが、 editable のパラメーターを無視します。( auto_now には editable= ... 。通常、このオプションは無視できます。 モデル継承で使用される OneToOneField のように、フィールドが自動的に作成された場合は、 auto_created は True です。 高度な使用向けです。 上記のリストに説明のないオプションはすべて、通常のDjangoフィールドと同じ意味を ... ey や OneToOneField などのフィールドによって、データベースのカラムのデータ型を特定するために呼ばれます。たとえば、 UnsignedAutoField がある場合、同じデータ型を使うためにそのフィールドを指す外部キーも必要になります。 # MySQL unsigned integer (range 0 ... 2026年10月08日