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

Undelete does not clear the deleted at field #62

Open
natehawkboss opened this issue Apr 16, 2020 · 0 comments
Open

Undelete does not clear the deleted at field #62

natehawkboss opened this issue Apr 16, 2020 · 0 comments

Comments

@natehawkboss
Copy link

The issue I am noticing is that when you undelete a record, it makes the change in the database but does not seem to change the model instance.

So I have a deleted record, I undelete, make changes, and save

model.undelete()
model.field1 = 1
model.field2 = 2
model.save()
model.deleted
>>> True

then the deleted at field is still in the instance and it is re-added; it has a deleted_at so it shows as deleted, yet it doesn't have the changeset to undelete it. As of now, I have to explicitly call refresh_from_db to update

model.undelete()
model.deleted
>>> True
model.refresh_from_db()
model.deleted
>>> False
model.field1 = 1
model.field2 = 2
model.save()
model.deleted
>>> False

or just do all of my changes and then call undelete

model.field1 = 1
model.field2 = 2
model.save()
model.undelete()

it seems that undelete should not just update the table but the model instance as well.

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

No branches or pull requests

1 participant