django가 제대로 작동하려면 "스마트 선택"앱을 가져 오는 데 문제가 있습니다. 내 연결된 필드에 선택 항목을 채우지 않습니다. github "readme"파일 "https://github.com/digi604/django-smart-selects"는 다음 지침을 제공합니다.django 스마트 앱 선택
- 연결된 필드는 필드가 연결되어야하는 동일한 모델의 필드입니다.
- 체인 된 모델 필드는 연결된 필드에 의해 너무 연결된 모델에 해당하는 체인 모델의 필드입니다.
지침을 약간 은폐하고 대륙 및 현의 모델을 쉽게 보여주기 위해 표시하지 않습니다.
이전 질문에 대한 답변을 얻지 못했습니다. 내 특정 모델에 대한 자세한 정보가 있습니다. "http://stackoverflow.com/questions/9155350/django-smart-selects-second-level-wont-populate"
"django-smart-select"전문가들이 저를 고비에서 넘겨 줄 수 있기를 바랍니다. . 국가 = ChainedForeignKey() 필드의 주어진 예에서 감사
from smart_selects.db_fields import ChainedForeignKey
class Location(models.Model)
continent = models.ForeignKey(Continent)
country = ChainedForeignKey(
Country,
chained_field="continent",
chained_model_field="continent",
show_all=False,
auto_choose=True
)
area = ChainedForeignKey(Area, chained_field="country", chained_model_field="country")
city = models.CharField(max_length=50)
street = models.CharField(max_length=100)
그것이 내가 해석 한 방식이기도합니다. 그러나 작동하지 않습니다. – BillB1951
늦게 답변을 드려 죄송합니다. 그렇지만 Country 클래스에는 대륙에 대한 ForeignKey가 있어야하며 Area에는 Country에 대한 ForeignKey가 필요하고 City에는 Chain에 대한 ForeignKey와 Area 등이 필요합니다. – dragonx