Re: Recipe / Ingredient Model

2007-08-02 Thread Shane Graber
LOL, you don't know how often this happens to me.  :P

Shane


On 8/2/07, Lucky B <[EMAIL PROTECTED]> wrote:
>
> God, 0/2, just do what John proposed, I am not thinking straight right
> now, what I would give for an edit capability on my emails, I'll spend
> all of tonight removing my foot from my mouth.
>
> On Aug 2, 10:49 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> > Ok, I've thought about it some more, and came up with 
> > this:http://dpaste.com/hold/15915/
> > It's not quite what you asked for, for your idea of the interface
> > you're gonna have to either code a QuantityField type field to merge
> > both the quantity and unit, or just write views that accommodate the
> > middle-man model. I am pretty sure that's the only way to do it, but I
> > could be wrong.
> >
> > On Aug 2, 10:29 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> >
> > > ack, I missed a few things, the ingredient-quantity measure. not sure
> > > how to do that. ignore my previous message.
> >
> > > On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> >
> > > > 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 21/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
>
>
> >
>


-- 
Shane  ∞  http://liquid.homelinux.org
-
Bender: "Amy, you like cute things so I baked you a pony."
-

http://www.reefs.org - Where reefkeeping begins on the internet.
http://www.advancedaquarist.com - High quality, free monthly publication for
the reef keeping hobbyist.
http://www.aquaristcourses.org - Distance learning courses for the
marine aquarist.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Recipe / Ingredient Model

2007-08-02 Thread Shane Graber

Excellent!  This is exactly what I was looking for.  Thanks for the help!

Shane


On 8/2/07, John Danks <[EMAIL PROTECTED]> wrote:
>
> On 8/2/07, 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.
>
> Not sure if this is the best way, but it works for me: 
> http://dpaste.com/15913/
>
> Basically ingredients like chicken, onions, etc are going to be in
> lots of recipes but the quantity will be different in each. So make
> one model for each type of ingredient, and another model to combine an
> ingredient and a quantity. Then use edit_inline to make it convenient
> to edit in the admin.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

God, 0/2, just do what John proposed, I am not thinking straight right
now, what I would give for an edit capability on my emails, I'll spend
all of tonight removing my foot from my mouth.

On Aug 2, 10:49 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> Ok, I've thought about it some more, and came up with 
> this:http://dpaste.com/hold/15915/
> It's not quite what you asked for, for your idea of the interface
> you're gonna have to either code a QuantityField type field to merge
> both the quantity and unit, or just write views that accommodate the
> middle-man model. I am pretty sure that's the only way to do it, but I
> could be wrong.
>
> On Aug 2, 10:29 pm, Lucky B <[EMAIL PROTECTED]> wrote:
>
> > ack, I missed a few things, the ingredient-quantity measure. not sure
> > how to do that. ignore my previous message.
>
> > On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
>
> > > 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 21/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 django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

Ok, I've thought about it some more, and came up with this:
http://dpaste.com/hold/15915/
It's not quite what you asked for, for your idea of the interface
you're gonna have to either code a QuantityField type field to merge
both the quantity and unit, or just write views that accommodate the
middle-man model. I am pretty sure that's the only way to do it, but I
could be wrong.

On Aug 2, 10:29 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> ack, I missed a few things, the ingredient-quantity measure. not sure
> how to do that. ignore my previous message.
>
> On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
>
> > 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 21/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 django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Recipe / Ingredient Model

2007-08-02 Thread John Danks

On 8/2/07, 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.

Not sure if this is the best way, but it works for me: http://dpaste.com/15913/

Basically ingredients like chicken, onions, etc are going to be in
lots of recipes but the quantity will be different in each. So make
one model for each type of ingredient, and another model to combine an
ingredient and a quantity. Then use edit_inline to make it convenient
to edit in the admin.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

ack, I missed a few things, the ingredient-quantity measure. not sure
how to do that. ignore my previous message.

On Aug 2, 10:27 pm, Lucky B <[EMAIL PROTECTED]> wrote:
> 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 21/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 django-users@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Recipe / Ingredient Model

2007-08-02 Thread Lucky B

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 21/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 django-users@googlegroups.com
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
-~--~~~~--~~--~--~---