[英]Django - field of language choices
I want to let user choose from languages they speak. 我想让用户从他们说的语言中进行选择。 Is there a Django built in list of languages or should I get list of languages from other source? 是否有内置的Django语言列表,还是应该从其他来源获得语言列表?
For now: 目前:
class UserProfile(models.Model):
languages = models.ManyToManyField(Language)
class Language(models.Model):
shortcut ...
name ...
The languages field should only be able to list all languages user can speak. 语言字段只能列出用户可以说的所有语言。
There's the django-language-field . 有django-language-field 。 Unfortunately, it's sorted by the language code instead of the language name. 不幸的是,它是按语言代码而不是语言名称排序的。
Django doesn't have a build-in list of lenguages! Django没有内置的语言列表! You have to get your list of lenguages from other source! 您必须从其他来源获取语言列表! For example you might see: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 例如,您可能会看到: https : //en.wikipedia.org/wiki/List_of_ISO_639-1_codes
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.