... ップを実現できます。 たとえば、次のようにしてタグ付けシステムに使用できます: from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models class TaggedItem ( models . Model ... ForeignKey ( ContentType , on_delete = models . CASCADE ) object_id = models . PositiveBigIntegerField () content_object = GenericForeignKey ( "content_type" , "object_id" ) def __str__ ( self ): return self . tag class Meta : indexes = [ models . Index ( fields ... Key を使用する場合、タグを格納する単一のモデルを選択する必要があります。contenttypes アプリケーションは特別なフィールド型( GenericForeignKey ) を提供し、これにより、リレーションシップを任意のモデルと設定できます。 class GenericForeignKey [ソース] ¶ GenericForeign ... ... ップを実現できます。 たとえば、次のようにしてタグ付けシステムに使用できます: from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models class TaggedItem ( models . Model ... ForeignKey ( ContentType , on_delete = models . CASCADE ) object_id = models . PositiveBigIntegerField () content_object = GenericForeignKey ( "content_type" , "object_id" ) def __str__ ( self ): return self . tag class Meta : indexes = [ models . Index ( fields ... Key を使用する場合、タグを格納する単一のモデルを選択する必要があります。contenttypes アプリケーションは特別なフィールド型( GenericForeignKey ) を提供し、これにより、リレーションシップを任意のモデルと設定できます。 class GenericForeignKey [ソース] ¶ GenericForeign ... ... Fixed incorrect foreign key constraint name for models with quoted db_table ( #28876 ). Fixed a regression in caching of a GenericForeignKey when the referenced model instance uses more than one level of multi-table inheritance ( #28856 ). 目次 Django 1.11.9 リリ ... ... Fixed incorrect foreign key constraint name for models with quoted db_table ( #28876 ). Fixed a regression in caching of a GenericForeignKey when the referenced model instance uses more than one level of multi-table inheritance ( #28856 ). 目次 Django 1.11.9 リリ ... ... lookups for CICharField , CIEmailField , and CITextField use a citext cast ( #28702 ). Fixed a regression in caching of a GenericForeignKey when the referenced model instance uses multi-table inheritance ( #28856 ). Fixed "Cannot change column 'x': used in a for ... ... lookups for CICharField , CIEmailField , and CITextField use a citext cast ( #28702 ). Fixed a regression in caching of a GenericForeignKey when the referenced model instance uses multi-table inheritance ( #28856 ). Fixed "Cannot change column 'x': used in a for ... ... foreign and primary key ( #24951 ). Fixed AssertionError in some complex queries ( #24525 ). Fixed a migrations crash with GenericForeignKey ( #25040 ). Made translation.override() clear the overridden language when a translation isn't initially active ( #25295 ) ... ... 下のチェックは GenericInlineModelAdmin のインラインとして登録された ModelAdmin に対して行われます。 admin.E301 : <model> に GenericForeignKey がありません。 admin.E302 : 'ct_field' は <label> を参照していますが、これは <model> 上のフィールドではありません。 admin. ... E303 : 'ct_fk_field' は <label> を参照していますが、これは <model> 上のフィールドではありません。 admin.E304 : <model> の GenericForeignKey が、コンテンツタイプのフィールド <field name> とオブジェクトIDのフィールド <field name> を使用していません。 AdminSite ¶ デ ... 前に django.contrib.auth.middleware.AuthenticationMiddleware をMIDDLEWAREで定義する必要があります。 contenttypes ¶ モデルに GenericForeignKey または GenericRelation が含まれる場合、以下のチェックが行われます: contenttypes.E001 : GenericForeignKey オブジェクトの ID ... ... foreign and primary key ( #24951 ). Fixed AssertionError in some complex queries ( #24525 ). Fixed a migrations crash with GenericForeignKey ( #25040 ). Made translation.override() clear the overridden language when a translation isn't initially active ( #25295 ) ... ... 下のチェックは GenericInlineModelAdmin のインラインとして登録された ModelAdmin に対して行われます。 admin.E301 : <model> に GenericForeignKey がありません。 admin.E302 : 'ct_field' は <label> を参照していますが、これは <model> 上のフィールドではありません。 admin. ... E303 : 'ct_fk_field' は <label> を参照していますが、これは <model> 上のフィールドではありません。 admin.E304 : <model> の GenericForeignKey が、コンテンツタイプのフィールド <field name> とオブジェクトIDのフィールド <field name> を使用していません。 AdminSite ¶ デ ... 前に django.contrib.auth.middleware.AuthenticationMiddleware をMIDDLEWAREで定義する必要があります。 contenttypes ¶ モデルに GenericForeignKey または GenericRelation が含まれる場合、以下のチェックが行われます: contenttypes.E001 : GenericForeignKey オブジェクトの ID ... 2026年10月08日