-
Notifications
You must be signed in to change notification settings - Fork 122
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
cannot unpack non-iterable NoneType object with SOFT_DELETE_CASCADE
#235
Comments
I just added a test with your model which works: 6cdd3e8 Are you using the last version of safedelete? Do you overwrite the delete method? |
I got the same error on macbook air m1 |
Same issue 1.3.2, haven't overwritten any methods, occurring when using the SOFT_DELETE_CASCADE policy. Could it be to do with handling cascaded soft deletions when there are no related objects? |
@Gagaro No, it seems like soft delete has problems with children-parent models, also has with django-mptt for tree models. related issue in django-mptt repo: |
I made a test that passed without issue. Are you using your model like that or do you have any idea how to reproduce it? 6cdd3e8#diff-985ae0f484f9a15bfb9b8e016c13075eb6896094ff89516544436dce6c63c4feR297 |
@Gagaro Try deleting from django admin. |
My friend overwritten delete method without return like this: |
To expand on @razdva0 answer, I had a model with an overridden |
Thanks for the feedbacks. @hamidrabedi , do you have a delete method which does not return anything? |
@Gagaro Yes i do have a delete method, but it calls the super method and returns the result properly: def delete(self, *args, **kwargs):
"""
This method calls the superclass's delete()
method with the given parameters, and then invalidates
the cache for the query set's model.
"""
result = super().delete(**kwargs)
self.invalidate_cache()
return result |
Do you have more parent classes? Do you have a value for |
@Gagaro I found where the problem is, when i try to delete one object normally everything works just fine, but when i call the queryset.delete method in the admin, it raises the error: what gets called in django admin So when you delete one object there is no response returning and it tries to unpack it : |
there is no result it raises errors |
What classes are you inheriting from? |
@Gagaro |
It looks good to me. Could you maybe step into all the subsequent |
@Gagaro Oh i see, delete got overridden and is returning data.ok i got it. |
I have a parent child model and i want if the parent object got deleted all the children get deleted too (safe delete in my case):
and if i delete the parent object this error will be raised:
cannot unpack non-iterable NoneType object
The text was updated successfully, but these errors were encountered: