New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsaved related object fix #1551

Closed
phillxnet opened this Issue Nov 29, 2016 · 3 comments

Comments

Projects
None yet
1 participant
@phillxnet
Member

phillxnet commented Nov 29, 2016

Thanks to forum member rockmar for reporting this 3.8.15-11 issue. It would seem that in addition to the already altered save order to cater for our new django v 1.8.16 strickter behaviour:
fd59e32
there appears to be a related issue in pool.py:

File "/opt/rockstor/src/rockstor/rest_framework_custom/generic_view.py", line 40, in handleexception
yield
File "/opt/rockstor/src/rockstor/storageadmin/views/pool.py", line 268, in post
p.disk_set.add(*disks)
File "/opt/rockstor/eggs/Django-1.8.16-py2.7.egg/django/db/models/fields/related.py", line 750, in add
obj.save()
File "/opt/rockstor/eggs/Django-1.8.16-py2.7.egg/django/db/models/base.py", line 685, in save
"unsaved related object '%s'." % field.name
ValueError: save() prohibited to prevent data loss due to unsaved related object 'pool'.

Please update the following forum thread with this issues resolution:
https://forum.rockstor.com/t/unable-to-create-pools-3-8-15-11-unsaved-related-object/2420

@phillxnet

This comment has been minimized.

Show comment
Hide comment
@phillxnet

phillxnet Nov 29, 2016

Member

Having a quick look at this one now.

Member

phillxnet commented Nov 29, 2016

Having a quick look at this one now.

phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Nov 29, 2016

save pool object as django 1.8 more strict rockstor#1551
Akin to an earlier change in disk.py but this time in
pool.py
@phillxnet

This comment has been minimized.

Show comment
Hide comment
@phillxnet

phillxnet Nov 29, 2016

Member

With the above added p.save() command/commit a pool was successfully created in an identical scenario that had previously reproduced the original reporters error.

Member

phillxnet commented Nov 29, 2016

With the above added p.save() command/commit a pool was successfully created in an identical scenario that had previously reproduced the original reporters error.

schakrava added a commit that referenced this issue Nov 30, 2016

save pool object as django 1.8 more strict #1551
Akin to an earlier change in disk.py but this time in
pool.py

schakrava added a commit that referenced this issue Nov 30, 2016

Remove redundant save(). #1551
disk_set.add() in the above line implicitly calls save on pool because it's a
ForeignKey. See https://docs.djangoproject.com/en/1.8/ref/models/relations/#django.db.models.fields.related.RelatedManager.add
@phillxnet

This comment has been minimized.

Show comment
Hide comment
@phillxnet

phillxnet Nov 30, 2016

Member

Closing as fixed by #1552 :
f01345b
and:
035ed73

Member

phillxnet commented Nov 30, 2016

Closing as fixed by #1552 :
f01345b
and:
035ed73

@phillxnet phillxnet closed this Nov 30, 2016

@schakrava schakrava changed the title from django save issue in testing channel to unsaved related object fix Dec 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment