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