0
를 사용하여 항목을 제한하기 : MyApp를에/Models.py어떻게이 개 모델이 외래 키
class Foo(models.Model):
place = models.CharField(max_length=200)
foo_admin = models.ForeignKey(User, limit_choices_to={'is_staff': True})
class Fighter(models.Model):
foo = models.ForeignKey(Foo,limit_choices_to={'foo_admin': currentuser})
을 'currentuser'또는 (사용자 이름)를 얻을 수 및 외래 키의 선택을 제한하는 방법이 있나요? 즉, 'currentuser'가 Foo에 저장된 foo_admin과 동일한 경우에만 Fighter가 Fighter를 표시합니다.
한계는 어떻게됩니까? 특정 번호로? – WTK
choise를 한 사용자 (즉, 현재 사용자)로 제한하십시오. 나는 분명하다. – vnayak01