title: django: search by ingredients in a Drinkdatabase
body: <p>I want to create a Django filter, which looks for ingredients, which are included in a drink. However, no other ingredients may be present, only those I enter. </p>
  
  <h2>Example:</h2>
  
  <ul>
  <li>Drink: Gin Tonic<br>Ingredients: Gin, Tonic</li>
  <li>Drink: Whiskey Cola<br>Ingredients: Whiskey Cola</li>
  <li>Drink: Rum Cola<br>Ingredients: Rum, Cola</li>
  </ul>
  
  <p>I admit I have cola and gin and tonic.</p>
  
  <p>The following drinks should come back:</p>
  
  <ul>
  <li>Gin Tonic</li>
  </ul>
  
  <p>Rum cola isn't coming back because I don't have rum.</p>
  
  <p>How I can do this in Django? I have a database calles TankAllocation. There I enter the ingredients for every tank.</p>
  
  <p>I tryed with Django filter, but there I don't get the correct drinks.</p>
  
  <p>Maybe i can compare the query set of the ingredients of Ingredients table and Tank table and delete duplicate entries, then start a non-equal query with: from django.db.models import Q. But how can I delete duplicate entries in the querieset? both entries should be deletet for a new filter query.</p>
  
  <p>Models.py</p>
  
  <pre><code>from django.db import models
  
  class Drink(models.Model):
      name = models.CharField(max_length=256, unique=True)
      description = models.TextField()
      image_path = models.ImageField(upload_to=".\images")
      slug = models.SlugField(unique=True)
      ingredient = models.ManyToManyField('Ingredient', through='IngredientRatio', related_name='mischung',)
  
      def __str__(self):
          return self.name
  
  class Ingredient(models.Model):
      name = models.CharField(max_length=256, unique=True)
      alcohol = models.BooleanField()
  
      def __str__(self):
          return self.name
  
  class IngredientRatio(models.Model):
      quantity = models.DecimalField(max_digits=4, decimal_places=2)
      ingredient = models.ForeignKey('Ingredient', on_delete=models.CASCADE)
      drink = models.ForeignKey('Drink', on_delete=models.CASCADE)
  
      def __str__(self):
          return "{0}: {1} : {2}".format(self.drink.name, self.ingredient.name, self.quantity)
  
  class TankAllocation(models.Model):
      name = models.CharField(max_length=8, unique=True)
      allocation = models.ForeignKey('Ingredient', on_delete=models.CASCADE, default='NULL', related_name='ingredients')
  
      def __str__(self):
          return "{0}: {1}".format(self.allocation.name, self.name)
  
  
  </code></pre>
  
  <p>Thank you for helping, I'm very new in programming :)))</p>