Now I have product model like that
class Product(models.Model):
attrs = models.ManyToMany('ProductAttribute',
through='ProductAttributeValue')
...some fields
Now I want to create some fake data using faker and model mommy
like that
[mommy.make(Product, title=ff.text(max_nb_chars=25), description=ff.text(max_nb_chars=80), categories=Category.objects.filter(depth=3), product_class=ProductClass.objects.first(), attributes=ProductAttribute.objects.all())
for _ in range(15)]
How can I pass ProductAttributeValue.objects.filter(..filters..)
to m2m modelmommy recipes or whatever within through
field
Aucun commentaire:
Enregistrer un commentaire