Giter Site home page Giter Site logo

Comments (9)

Gagaro avatar Gagaro commented on July 17, 2024

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.

Gagaro avatar Gagaro commented on July 17, 2024

Also, we should add a test to ensure this is solved on every version.

from django-safedelete.

Gagaro avatar Gagaro commented on July 17, 2024

I did some tests and the _base_manager 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.

sbussetti avatar sbussetti commented on July 17, 2024

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.

rromanchuk avatar rromanchuk commented on July 17, 2024

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.

Gagaro avatar Gagaro commented on July 17, 2024

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.

rromanchuk avatar rromanchuk commented on July 17, 2024

@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.

Gagaro avatar Gagaro commented on July 17, 2024

Hi @rromanchuk, do you still have the problem?

from django-safedelete.

Gagaro avatar Gagaro commented on July 17, 2024

Reopen this issue if you have more info/can reproduce in tests.

from django-safedelete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.