Comments (9)
The easiest way would be to add _do_update
to the SafeDeleteMixin and just call super
with a different base_qs
. I won't have time to test this until tuesday though.
from django-safedelete.
Also, we should add a test to ensure this is solved on every version.
from django-safedelete.
I did some tests and the _base_manage
r is actually the Django one. And these tests should fail if there is a problem. Do you overwrite the _base_manager
manually on your models?
https://github.com/makinacorpus/django-safedelete/blob/master/safedelete/tests.py#L148-L169
from django-safedelete.
I'll do a little more research and commit some tests that demonstrate the issue. I actually have to override _base_manager to set it back to models.Manager.
from django-safedelete.
Hey guys quick question, documentation says DELETED_INVISIBLE
is the default, yet i'm still able to retrieve a soft deleted object, am i missing something here?
>>> user = User.users.get(pk=user.guid)
>>> user.deleted
True
from django-safedelete.
Hi @rromanchuk, what version are you using and how is your model configured?
It works fine with the 3.2 and the default SoftDeleteMixin
:
>>> User.objects.create(name='toto')
<User: User object>
>>> User.objects.get()
<User: User object>
>>> User.objects.get().pk
1
>>> a = User.objects.get()
>>> a.delete()
>>> a.deleted
True
>>> User.objects.all()
[]
>>> User.objects.get(pk=1)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/gagaro/.virtualenvs/django1.8-python3.4/lib/python3.4/site-packages/safedelete/managers.py", line 72, in get
return self.get_queryset().get(*args, **kwargs)
File "/home/gagaro/.virtualenvs/django1.8-python3.4/lib/python3.4/site-packages/django/db/models/query.py", line 334, in get
self.model._meta.object_name
models_test.models.DoesNotExist: User matching query does not exist.
>>> User.objects.get(pk=1)
from django-safedelete.
@Gagaro it's probably just user error, let me try again with fresh eyes. Here is what I have though.
my_mixin = safedelete_mixin_factory(policy=SOFT_DELETE)
class User(my_mixin):
with requirements.txt
django-safedelete==0.3.2
from django-safedelete.
Hi @rromanchuk, do you still have the problem?
from django-safedelete.
Reopen this issue if you have more info/can reproduce in tests.
from django-safedelete.
Related Issues (20)
- Safe delete does not work as expected with OneToOneField HOT 2
- TypeError: cannot unpack non-iterable NoneType object HOT 3
- add type annotation HOT 3
- SafeDeleteQuery AttributeError on _safedelete_visibility and _safedelete_visibility_field HOT 8
- Setting highlight_deleted_field.short_description mistakenly affects all subclasses of SafeDeleteAdmin HOT 1
- Behaviour of SOFT_DELETE on an object with a PROTECTED relationship to another SOFT_DELETED object HOT 1
- Django 4.2 support HOT 1
- Soft delete model object and cascading delete all related objects which are not instance of SafeDeleteModel HOT 2
- deleted_objects is not documented anywhere HOT 2
- Fields uniqueness with MySQL HOT 2
- delete method hangs on raise ProtectedError, when a lot of related protected objects HOT 1
- HARD_DELETE in SafeDeleteQueryset bypasses custom delete logic HOT 1
- Infinite recursive loop with SafeDeleteQueryset HOT 2
- Is it possible to set _safedelete_visibility without having to define a Manager? HOT 1
- cannot unpack non-iterable NoneType object with `SOFT_DELETE_CASCADE` HOT 17
- get_queryset filteration for related models
- If using django-simple-history, is this needed? HOT 2
- How can I use SafeDeleteQueryset and SafeDeleteManager at the same time?
- pkg_resources deprecation warning HOT 1
- Custom UniqueConstraint do not works with OneToOneField HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-safedelete.