class UserCustomer(models.Model):
user = models.ForeignKey(User)
customer = models.ForeignKey(CustomerProfile)
新しいレコードを追加する際に、ユーザーが既に関連付けられている場合、ユーザードロップダウンで「ユーザー」を制限(削除)することは可能ですか?どの顧客とでも?Django - models.ForeignKey()内のエントリを制限する
class UserCustomer(models.Model):
user = models.ForeignKey(User)
customer = models.ForeignKey(CustomerProfile)
新しいレコードを追加する際に、ユーザーが既に関連付けられている場合、ユーザードロップダウンで「ユーザー」を制限(削除)することは可能ですか?どの顧客とでも?Django - models.ForeignKey()内のエントリを制限する
いいえ、質問は新しいレコードの追加に固有です。表示リストにありません。どんな喉頭? –
@siva管理サイトのドロップダウンリストにない場合は、挿入用に使用できません。 –
[Qerysetを制限する方法/ Djangoの管理サイトで表示するレコードは?](http://stackoverflow.com/questions/2279313/how-to-limit-queryset-the-records-to-view -in-django-admin-site) –
@Ignacio新しいレコードの追加中に制限することはできますか? –
[これ](http://docs.djangoproject.com/ja/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to)を試しましたか? – crodjer