title: How to createview django manytomany models
body: <p>been trying to save my recipe-ingredients and ingredient-measure to my recipe db.</p>
  <p>i tried a model like this:</p>
  <pre><code>class IngredientList(models.Model):
      unit = [
          ('lb', 'pound'),
          ('oz', 'ounce'),
          ('tsp', 'teaspoon'),
          ('tbsp', 'tablespoon'),
          ('G', 'gallon'),
          ('ml', 'mililitre'),
          ('l', 'litre'),
          ('g', 'gram'),
          ('kg', 'kilogram'),
  
      ]
      name = models.CharField(max_length=100)
      image = models.ImageField(default='img.jpg')
      #recipes = models.ManyToManyField('Recipe', through='RecipeList')
      protein = models.FloatField()
      fat = models.FloatField()
      carb = models.FloatField()
      units = models.CharField(max_length=10, choices=unit)
  
      def __str__(self):
          return self.name
      return self.ingredient.name
  
  
  class Recipe(models.Model):
  
      name = models.CharField(max_length=100)
      ingredients = models.ManyToManyField(
          'IngredientList', through='RecipeList')
      instructions = models.TextField(max_length=3000)
      serving_size = models.IntegerField()
      image = models.ImageField(default='recipe.jpg')
      duration = models.IntegerField(blank=True, default=0)
  
      def __str__(self):
          return self.name
  
      def get_absolute_url(self):
          return reverse('recipe-detail', kwargs={'pk': self.pk})
  
  
  class RecipeList(models.Model):
      recipe = models.ForeignKey(RecipeList, on_delete=models.CASCADE)
      ingredients = models.ForeignKey(IngredientList, on_delete=models.CASCADE)
      measurement = models.FloatField()
  
      def __str__(self):
          return self.recipe.name
  </code></pre>
  <p>Found this form on a stackoverflow answer:</p>
  <pre><code>class RecipeForm(forms.Form):
      name = forms.CharField()
      ingredient = forms.ModelMultipleChoiceField(IngredientList.objects.all())
      instructions = forms.CharField()
      count = forms.IntegerField()
      serving = forms.IntegerField()
  </code></pre>
  <p>and this CreateView as well:</p>
  <pre><code>class RecipeCreateView(FormView):
      template_name = &quot;recipe/shoppinglist_form.html&quot;
      form_class = RecipeForm
  
      def form_valid(self, form):
          name = form.cleaned_data['name']
          ingredient = form.cleaned_data['ingredient']
          instructions = form.cleaned_data['instructions']
          serving = form.cleaned_data['serving']
  
          recipe = RecipeList(name=name)
          recipe.save()
          ingredient_list = IngredientList.objects.filter(pk__in=ingredient)
          for i in ingredient_list:
              recipe.ingredients.add(i)
  
          return render(request, 'recipe/recipe.html')
  </code></pre>
  <p>When I submit, yes I do get the ingredients and the name of the recipe. However i am unable to state the measurement of each ingredient, and also the other details aren't being filled ( serving_size, instructions...)</p>
  <p>Please someone help!</p>