Skip to content
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

save() prohibited to prevent data loss due to unsaved related object 'Mailbox' #219

Open
sane5ek opened this issue Jan 7, 2020 · 1 comment

Comments

@sane5ek
Copy link

sane5ek commented Jan 7, 2020

If you have Djongo (MongoDB Connector based on pymongo) in your project:

save() prohibited to prevent data loss due to unsaved related object 'Mailbox'

when trying to

mailbox.get_new_mail()

That's because Djongo use Model._id instead of Model.id field. When trying to save mailbox object again, that creates new database record with the same fields as mailbox object.

My fix - import models from djongo app in django_mailbox.models file and adding field

_id = models.ObjectIdField()

in Mailbox model.

@pfouque
Copy link
Collaborator

pfouque commented Dec 23, 2023

Hello,
Do you have a stack trace or can you pinpoint the line generating this error?
Thanks

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

No branches or pull requests

2 participants