简体   繁体   English

Django本地风味选择小部件列表

[英]Django local flavor select widget list

My question is pretty siemple, but is being hard for me to find an easy way to do this. 我的问题很简单,但是我很难找到简单的方法来做到这一点。

I have a website where I need to make three dropdowns: 我有一个网站,需要在其中添加三个下拉菜单:

  1. One for countrys 一个国家
  2. One for regions 一个地区
  3. One for sub-regions 一个用于次区域

My website has multiple languages. 我的网站有多种语言。 What I need to do is making a 'select widget' whose input is the current language, and drop down a list of the countries in that language. 我需要做的是制作一个“选择小部件”,其输入是当前语言,然后下拉使用该语言的国家/地区列表。 After selecting the country, a second select with subregions from that country and language. 选择国家/地区后,第二次选择带有该国家/地区和语言的子区域。 And so. 所以。

For example: 3 dropdowns. 例如:3个下拉菜单。 Spain - Balearic Island - Palma de Mallorca 西班牙-巴利阿里岛-马略卡岛帕尔马

I'm using Django 1.5 with a PostgreSql. 我将Django 1.5与PostgreSql一起使用。

Can you help me out with this please? 你能帮我这个忙吗? :) :)

After investigating for a while a decided just to make one drop down list with only countries. 经过一段时间的调查后,决定只列出一个国家/地区的下拉列表。 Regions and subregions are left as free text for users. 区域和子区域保留为用户的自由文本。

Making a multilingual dropdown for regions and subregions is quite hard, so many combinations. 要对区域和次区域进行多语言下拉菜单非常困难,因此有很多组合。 Some big developed project such as Prestashop do it in this way. 一些大型的开发项目(例如Prestashop)就是以此方式完成的。

Hope this help someone ;) 希望这可以帮助某人;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM