title: I want to have the choice for 2 variations with one product in Django
body: <p>Hi I have Product model , ProductColor and Product Size model. I want to link product with size and color properly, For eg my user when they select say Small size for A prouct(Tshrit) it should shows only available color for that small size.</p>
  
  <pre><code>class Product(models.Model):
      title = models.CharField(max_length=120)
      description = models.TextField(blank=True, null=True)
      price = models.DecimalField(decimal_places=2,max_digits=1000)
      active =models.BooleanField(default=True)
      weight = models.CharField(max_length=100, null=True, blank=True)
  
  class ProductColor(models.Model):
      product = models.ForeignKey(Product)
      color = models.CharField(max_length=120)
      active = models.BooleanField(default=True)
  
          def __str__(self):
              return self.color
  
          def get_absolute_url(self):
              return self.product.get_absolute_url()
  </code></pre>
  
  <h1>product Size</h1>
  
  <pre><code>CHOOSE_SIZE = (
  ('Extra Small', 'XS'),
  ('Small', 'S'),
  ('Medium', 'M'),
  ('Large', 'L'),
  ('Extra Large', 'XL'),
  ('Double Large', 'XXL'),
  ('Triple Large', 'XXXL'),
  )
  </code></pre>
  
  <h1>variation for product to choose size</h1>
  
  <pre><code>class ProductSize(models.Model):
      product = models.ForeignKey(Product)
      size = models.CharField(max_length=120, choices=CHOOSE_SIZE)
      price = models.DecimalField(decimal_places=2, max_digits=20)
      sale_price = models.DecimalField(decimal_places=2, max_digits=20, null=True, blank=True)
      active = models.BooleanField(default=True)
  
          def __str__(self):
              return self.size
  
          def get_absolute_url(self):
              return self.product.get_absolute_url()
  </code></pre>
  
  <h1>product detail Html page</h1>
  
  <pre><code>  &lt;div class="col-sm-4"&gt;
      &lt;h3&gt;{{ object.price }}&lt;/h3&gt;
              &lt;!-- &lt;select class="form-control"&gt;
                  {% for vari_obj in object.productsize_set.all %}
                      &lt;option value="{{ vari_obj.id }}"&gt;{{ vari_obj }}
                      &lt;/option&gt;
                  {% endfor %}
                   &lt;/select&gt; --&gt;
          {% if object.variation_set.count &gt; 1 %}
              &lt;h5&gt;Size&lt;/h5&gt;
                  &lt;select class="form-control"&gt;
                  {% for vari_obj in object.productsize_set.all %}
                      &lt;option value="{{ vari_obj.id }}"&gt;{{ vari_obj }}
                      &lt;/option&gt;
                  {% endfor %}
                   &lt;/select&gt;
          {% endif %}
          &lt;br/&gt;
          &lt;h5&gt;Available Color&lt;/h5&gt;
               &lt;select class="form-control"&gt;
                  {% for color_obj in object.productcolor_set.all %}
                      &lt;option value="{{ color_obj.id }}"&gt;{{ color_obj }}
                      &lt;/option&gt;
                  {% endfor %}
              &lt;/select&gt;
      &lt;a href="#"&gt;Add to cart&lt;/a&gt;
      &lt;br/&gt;
      &lt;hr/&gt;
  &lt;/div&gt;&lt;!--end of col-sm-4!--&gt;
  </code></pre>
  
  <p>Thank You the current situation problem is since I have not linked product size and color properly, when I add Red Shirt Large, Red shirt Small and Blue color shirt Medium for the same product. On my Product detial page Dropdwon for avaialble color size is follow :Red,Red,Blue</p>