Django模型中的关键字字段 [英] Keywords Field in Django Model
问题描述
我是Django的初学者.在我的模型中,我有一个名为关键字的字段,我想在其中存储关键字(以逗号分隔).
I'm beginner in Django. In my model I have a Field named keywords that I want to store keywords in it (separated by comma).
用户可以输入复合关键字"learn Django"
或"Django model-Fields"
,并且我还想设置一个每个关键字的max_length
.还有一个 max?
个关键字!
A user may enter a compound keyword "learn Django"
or "Django model-Fields"
, and also I want to have the possibility to set a max_length
for every keyword. And a max ?
of keywords!
请问我该怎么做?
推荐答案
您可以使用 django taggit 或类似的应用.使用现有的应用程序还意味着您不必重复他们已经完成的工作,例如生成类似项目"查询集.
You can add this feature to any model using django taggit or a similar app. Using an existing app also means you don't have to repeat the work they've already done, such as producing a 'similar items' queryset.
这篇关于Django模型中的关键字字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!