I have two Django models Foo and Bar that have a ManyToMany relation:
Class Foo(models.model):
...
bars = models.ManyToManyField('Bar', related_name='foos')somewhere in the code, i do direct assignment to replace the relation with a new list:
foo_object.bars = [bar_object_list]
but i get:
FieldDoesNotExist: Foo_bars has no field named None
I use Django 1.8.3 with Oracle 12c
any help would be highly appreciated
Traceback (most recent call last):
File "<console>", line 2, in <module>
File "/home/user/Workspace/src/models.py", line 155, in create_from_dict
obj.bars.clear()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 1253, in __get__
through=self.field.rel.through,
File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/related.py", line 862, in __init__
source_field = through._meta.get_field(source_field_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/options.py", line 554, in get_field
raise FieldDoesNotExist('%s has no field named %r' % (self.object_name, field_name))
FieldDoesNotExist: Foo_bars has no field named None
i.e. foo.bars) will trigger the same error !!!