title: Chained Selects in Django [Module: django-smart-selects]
body: <p>I'm trying to use the django-smart-selects Module in order to create dependent dropdown lists. I've followed the documentation and defined models in which I used the 'ChainedForeignKey' in order to define a link between my companies and my products.</p>
  <p><strong>models.py</strong></p>
  <pre><code>class Company(models.Model):
      name = models.CharField(max_length=255)
  
      def __str__(self):
          return self.name
  
  
  class Product(models.Model):
      company = models.ForeignKey(Company, on_delete=models.CASCADE)
      name = models.CharField(max_length=255)
  
      def __str__(self):
          return self.name
  
  class Rates(models.Model):
      company = models.ForeignKey(Company, on_delete=models.CASCADE)
      product = ChainedForeignKey(
          Product,
          chained_field = &quot;company&quot;,
          chained_model_field = &quot;company&quot;,
          show_all = False,
          auto_choose = True,
          sort=True)
       taux_comm_1 = models.FloatField(validators=[MinValueValidator(0), MaxValueValidator(1)])
       taux_comm_2 = models.FloatField(validators=[MinValueValidator(0), MaxValueValidator(1)]) 
  </code></pre>
  <p>Then I have defined a form :</p>
  <p><strong>forms.py</strong></p>
  <pre><code>class Rates(forms.ModelForm):
      class Meta:
          model = Rates
          fields= ['company', 'product', 'taux_comm_1', 'taux_comm_2']
  </code></pre>
  <p>The data is retrieved from my database and I can select a company from the first dropdown list. The second list (Product), though, is locked. I've associated products to companies in my database ( using the foreign key ).</p>
  <p>If you guys have any ideas how I could solve that problem, that would be really good. I've searched for a similar issue but I couldn't find anything like it.</p>
  <p>Here is a screenshot of the form.</p>
  <p><a href="https://i.stack.imgur.com/CV6gr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CV6gr.png" alt="Here is a screenshot of the form" /></a></p>