46👍
✅
You need to instantiate your recipe:
class IngredientAddView(CreateView):
model=Ingredient
def get_initial(self):
recipe = get_object_or_404(Recipe, slug=self.kwargs.get('slug'))
return {
'recipe':recipe,
}
Source:stackexchange.com