Django Smart Select


v-star*위위
2025-03-21 06:04:55 (1小时前)
  1. UI功能通常位于用户选择Country的位置表单中,



</跨度>
,镇等

我一直在尝试使用的解决方案是https://github.com/digi604/django-

聪明
</跨度>

  • 选择

3 条回复
  1. 0# 生如夏花 | 2019-08-31 10-32



    我刚刚完成了类似的项目,我猜你的解决方案是:




    1. class InstrumentEquipmentType(models.Model):
      manufacturer_model_type = models.ForeignKey(InstrumentModelType)
      instrument_manufacturer = ChainedForeignKey(InstrumentManufactuer,
      chained_field=’instrument_model_type’,
      chained_model_field=’manufacturer_model_type’,
      auto_choose = True,
      show_all = False)
      equipment_type = models.CharField(max_length=100)

    2.     def __unicode__(self):  # Python 3: def __str__(self):
    3.       return unicode(self.equipment_type)
    4. </code>


    如果向我发送我的例子,请告诉我


  2. 1# 部落用户 | 2019-08-31 10-32



    试试Django Clever Selects




    https://github.com/PragmaticMates/django-clever-selects



    我在我的Django 1.6项目中使用它。在视图和表单中操作链(在巧妙选择中)更有用,而不是在模型中(如智能选择)。


登录 后才能参与评论