Hi all, when I use the array field to append a child model into the parent model, and save the parent djongo model, the ObjectID of the child model in the array does not get saved. Then when I update some fields in the child model, the parent model does not get updated.
Python script
```python
class Gateway(models.Model):
_id = models.ObjectIdField()
name = models.CharField(max_length=100, null=False, blank=False)
address = models.CharField(max_length=100, null=False, blank=False)
x_cor = models.FloatField(default=0)
y_cor = models.FloatField(default=0)
devices = models.ArrayField(
model_container=Device,
default=[]
)
sensors = models.ArrayField(
model_container=Sensors,
default=[]
)
class Room(models.Model):
_id = models.ObjectIdField()
name = models.CharField(max_length=100, null=False, blank=False)
room_type = models.CharField(max_length=100, default='None')
gateways = models.ArrayField(
model_container=Gateway,
default=[]
)
```
#### Traceback
[]
When I query for the parent model in the database, the gateway object then has no ID.
Anyone has the same problem or can tell me what I am doing wrong?
Thanks
One line description of the issue
Hi all, when I use the array field to append a child model into the parent model, and save the parent djongo model, the ObjectID of the child model in the array does not get saved. Then when I update some fields in the child model, the parent model does not get updated.
Python script