1
我有3個型號是這樣的:如何通過Django中的關係模型獲取對象的標籤?
Entry:
text = TextField(..)
...
Tag:
text = CharField(..)
...
EntryTag
entry = ForeignKey(Entry)
tag = ForeignKey(Tag)
基於EntryTag
對象,我想填充任何Entry
物體.tags
領域,即:
for e in myEntries:
e.tags = Tag.objects.filter(?) # how do I select which tags are related to e?
我怎樣才能做到這一點?
感謝,
謝謝! Teşekkürler:) – jeff