thanks.... yeah i think it's the only way...
On May 27, 7:27 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
> You can do this with an intermediate table:
>
> class Fruit(models.Model):
> name = models.CharField()
>
> def __unicode__(self):
> return ('%s' % (self.name))
>
> class FruitItem(models.Model):
> fruit = models.ForeignKey(Fruit)
> number = models.IntegerField()
>
> def __unicode__(self):
> return ('%s %s' % (self.number, self.fruit.__unicode__()))
>
> class FruitBag(models.Model):
> items = models.ManyToManyField(FruitItem)
>
> HTH,
> -richard
>
> On 5/27/08, Vladimir <[EMAIL PROTECTED]> wrote:
>
>
>
> > i have a question
>
> > is it possible to create 2 models
>
> > 1 models is a list of fruit like
> > - banana
> > - apple
> > - grapes
>
> > and 1 model is a bag of fruit, where i can put the number of the
> > fruits i have in my bag
> > like
>
> > - 2 banana
> > - 1 apple
>
> > is it possible to do that with a ManyToManyField?
>
> > and is it possible to control that with the django admin interface?
>
> > thanks! :)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---