Hey, 

I am trying to solve following problem and I got stuck. Any help is 
appreciated...

I have two models which represent a product and its parts. 

class Product(models.Model):
 name = models.CharField(max_length=200)
 average_daily = models.FloatField(default=0)
 average_monthly = models.IntegerField(default=0)
 prodparts = models.ManyToManyField('OrderItem')

class OrderItem(models.Model):
 name = models.CharField(max_length=200)
 description = models.CharField(max_length=500)
 delivery_time = models.IntegerField(default=5)
 order_quantity = models.IntegerField(default=100) 
 count = models.IntegerField(default=0)

In admin.py my intent was to display the prodparts with filter_horizontal 
but then I ran into the fact that some Products consist of OrderItems in 
various ammounts. For example Product1 has two OrderItems "Battery". Would 
it be a good solution to make prodparts a CharField and populate it from a 
custom admin form with a list of chosen OrderItems?

Right now I have no clue how to get it done in a proper Django way. Any 
suggestions? 

Thx in advance,
Christian

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37122eba-976e-468f-a5fd-f34e601b96b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to