Hello,
I'm trying to add a record to a ManyToMany table in a script.
/////
Below is my script:
coll = Collection.objects.all()
for a in coll:
a.thematerials_set = [a.material]
assert False, "End"
////
Below is my model
class Collection(models.Model):
name = models.CharField(max_length=200)
material = models.ForeignKey(ProductMaterial)
thematerials = models.ManyToManyField(ProductMaterial,
related_name="Materials")
///
I'm just trying to loop through all the collections and create a
record in my ManyToMany table that stores each collections current
material into the ManyToMany table ( I eventually want to rid my
collecion table of the material field ). I've added the assert
statement just so I don't go through all the collections. When I run
the script my assert statement gets it...however no record has been
added to my ManyToMany table.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---