You're missing just:
ingredients = models.ManyToManyField(Ingredient)
In your recipe model.
If you want a pretty interface in admin (if you're not using newforms-
admin) then:
ingredients = models.ManyToManyField('Ingredient',
filter_interface=models.HORIZONTAL)
On Aug 2, 10:13 pm, "Shane Graber" <[EMAIL PROTECTED]> wrote:
> I'm trying to make a recipe/ingredient application as my road to
> learning more about Django. Making a model of an ingredient and most
> of the recipe are relatively straight forward based on the excellent
> tutorials on the Django. However, I'm struggling with understanding
> how to hook in multiple ingredients into a recipe. Here's how I have
> my model setup:
>
> http://dpaste.com/hold/15911/
>
> I want to be able to add in new Ingredients from the /admin section of
> Django instead of supplying it as a tuple hardcoded into my model.
>
> When I create a Recipe, I need to have a series of rows below the
> title, description, first, last name, and pub_date section where I can
> select an Ingredient from a dropdown list and then to the right of the
> ingredient needs to be an CharField where I input how much of each
> component I need to add for that particular recipe. It would look
> like:
>
> Ingredient 1 2 tsp
> Ingredient 2 1/2 cup
> ...
>
> Each row starting with that Ingredient dropdown list followed by a CharField.
>
> Any help on hooking this functionality into the model would be
> *greatly* appreciated. Thanks!
>
> Shane
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---