GenericForeignKey を使用したモデルがあります。
class Breadcrumbs( models.Model ):
title = models.CharField( max_length = 256 )
limit = models.Q( app_label = 'news', model = 'NewsPost' )
content_type = models.ForeignKey( ContentType, limit_choices_to = limit )
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey( 'content_type', 'object_id' )
class Meta:
db_table = 'breadcrumbs'
デフォルトでは、object_id の入力テキスト ウィジェットがあります。
オプションで選択する方法は?また、デフォルトで NewsPost ID (または NewsPostのunicode ()) を入力したいと思います。