... ( 30 ) NOT NULL ); 技術的な注意点: By default, the name of the table ( myapp_person ) is automatically derived from model metadata, combining the name of the app ( myapp ) and the lowercase name of the model ( person ). See テーブル名 for more detai ... lete = models . CASCADE ) date_joined = models . DateField () invite_reason = models . CharField ( max_length = 64 ) class Meta : constraints = [ models . UniqueConstraint ( fields = [ "person" , "group" ], name = "unique_person_group" ) ] 中間モデル ... ィールドクラスを作成できます。自分自身のフィールドを作成する方法は、 カスタムのモデルフィールドを作成する で提供しています。 Meta オプション ¶ 内側に class Meta というクラスを定義することで、モデルのメタデータを設定できます。 from django.db import mode ... ... ( 30 ) NOT NULL ); 技術的な注意点: By default, the name of the table ( myapp_person ) is automatically derived from model metadata, combining the name of the app ( myapp ) and the lowercase name of the model ( person ). See テーブル名 for more detai ... lete = models . CASCADE ) date_joined = models . DateField () invite_reason = models . CharField ( max_length = 64 ) class Meta : constraints = [ models . UniqueConstraint ( fields = [ "person" , "group" ], name = "unique_person_group" ) ] 中間モデル ... ィールドクラスを作成できます。自分自身のフィールドを作成する方法は、 カスタムのモデルフィールドを作成する で提供しています。 Meta オプション ¶ 内側に class Meta というクラスを定義することで、モデルのメタデータを設定できます。 from django.db import mode ... ... ort ModelForm >>> from myapp.models import Article # Create the form class. >>> class ArticleForm ( ModelForm ): ... class Meta : ... model = Article ... fields = [ "pub_date" , "headline" , "content" , "reporter" ] ... # Creating a form to add an ar ... odels . CharField ( max_length = 100 ) authors = models . ManyToManyField ( Author ) class AuthorForm ( ModelForm ): class Meta : model = Author fields = [ "name" , "title" , "birth_date" ] class BookForm ( ModelForm ): class Meta : model = Book fiel ... sages についての注意 ¶ Error messages defined at the form field level ( django.forms.Field.error_messages ) or at the form Meta level always take precedence over the error messages defined at the model field level ( django.db.models.Field.error_messa ... ... どのシステムの他のパーツは、各モデルの機能を理解できるようになります。API は、各モデルクラスの _meta 属性からアクセス可能で、 django.db.models.options.Options オブジェクトのインスタンスとなっています。 提供されるメソッドと属 ... は、 FieldDoesNotExist 例外が発生します。 >>> from django.contrib.auth.models import User # A field on the model >>> User . _meta . get_field ( "username" ) <django.db.models.fields.CharField: username> # A field from another model that has a relation ... with the current model >>> User . _meta . get_field ( "logentry" ) <ManyToOneRel: admin.logentry> # A non existent field >>> User . _meta . get_field ( "does_not_ ... ... ort ModelForm >>> from myapp.models import Article # Create the form class. >>> class ArticleForm ( ModelForm ): ... class Meta : ... model = Article ... fields = [ "pub_date" , "headline" , "content" , "reporter" ] ... # Creating a form to add an ar ... odels . CharField ( max_length = 100 ) authors = models . ManyToManyField ( Author ) class AuthorForm ( ModelForm ): class Meta : model = Author fields = [ "name" , "title" , "birth_date" ] class BookForm ( ModelForm ): class Meta : model = Book fiel ... sages についての注意 ¶ Error messages defined at the form field level ( django.forms.Field.error_messages ) or at the form Meta level always take precedence over the error messages defined at the model field level ( django.db.models.Field.error_messa ... ... どのシステムの他のパーツは、各モデルの機能を理解できるようになります。API は、各モデルクラスの _meta 属性からアクセス可能で、 django.db.models.options.Options オブジェクトのインスタンスとなっています。 提供されるメソッドと属 ... は、 FieldDoesNotExist 例外が発生します。 >>> from django.contrib.auth.models import User # A field on the model >>> User . _meta . get_field ( "username" ) <django.db.models.fields.CharField: username> # A field from another model that has a relation ... with the current model >>> User . _meta . get_field ( "logentry" ) <ManyToOneRel: admin.logentry> # A non existent field >>> User . _meta . get_field ( "does_not_ ... ... 利用可能な Meta オプション ¶ abstract ¶ Options. abstract ¶ abstract = True の場合、このモデルは 抽象基底クラス になります。 app_label ¶ O ... p_label = "myapp" モデルを app_label.object_name または app_label.model_name という形式で表現したい場合は、それぞれ model._meta.label または model._meta.label_lower を使用します。 base_manager_name ¶ Options. base_manager_name ¶ モデルの _base_manage ... 義されたモデルは bookstore_book という名前のデータベーステーブルを持ちます。 データベーステーブル名を上書きするには、 class Meta の db_table パラメータを使用します。 データベースのテーブル名が SQL の予約語だったり、 Python の変数名では許されない文字( ... ... 利用可能な Meta オプション ¶ abstract ¶ Options. abstract ¶ abstract = True の場合、このモデルは 抽象基底クラス になります。 app_label ¶ O ... p_label = "myapp" モデルを app_label.object_name または app_label.model_name という形式で表現したい場合は、それぞれ model._meta.label または model._meta.label_lower を使用します。 base_manager_name ¶ Options. base_manager_name ¶ モデルの _base_manage ... 義されたモデルは bookstore_book という名前のデータベーステーブルを持ちます。 データベーステーブル名を上書きするには、 class Meta の db_table パラメータを使用します。 データベースのテーブル名が SQL の予約語だったり、 Python の変数名では許されない文字( ... ... デル index リファレンス 制約 (Constraint) リファレンス モデル _meta API リレーション先オブジェクトのリファレンス Model クラスのリファレンス モデルの Meta オプション モデルインスタンスリファレ ... ペレーション 次のトピックへ モデルフィールドリファレンス 関連キーワード リファレンス モデル 入門 属性 index 制約 Constraint meta リレーション Model Meta インスタンス QuerySet ルックアップ クエリ Query Expression 条件式 データベース クイック検索 Last u ... ... デル index リファレンス 制約 (Constraint) リファレンス モデル _meta API リレーション先オブジェクトのリファレンス Model クラスのリファレンス モデルの Meta オプション モデルインスタンスリファレ ... 次のトピックへ モデルフィールドリファレンス 関連キーワード リファレンス モデル フィールド 入門 属性 index 制約 Constraint meta リレーション オブジェクト Model クラス Meta インスタンス QuerySet ルックアップ クエリ Query Expression クイック検索 Last u ... 2026年10月08日