Giter Site home page Giter Site logo

Comments (20)

Gagaro avatar Gagaro commented on August 16, 2024 4

0.4.2 has been released with the fix.

from django-safedelete.

Gagaro avatar Gagaro commented on August 16, 2024 3

Thanks for the report, I fixed it in master but I don't have the time to do a release right now. It will be for next week now.

from django-safedelete.

AndreasBackx avatar AndreasBackx commented on August 16, 2024 1

@ewen we are aware of the issue and it'll get fixed in #77 as well.

from django-safedelete.

elmehalawi avatar elmehalawi commented on August 16, 2024

This is happening to me as well, but it's happening for pretty much most of my queries. I'm not sure if it's conflicting with some other library, but even something as simple as:

Item.objects.all()

results in an AssertionError: Cannot filter a query once a slice has been taken. I'm not sure what could be causing this.

from django-safedelete.

Gagaro avatar Gagaro commented on August 16, 2024

Does it work with the PR #77 ?

from django-safedelete.

ciarancourtney avatar ciarancourtney commented on August 16, 2024

@Gagaro I was getting this error for only some models in Django 1.11, error disappeared when I used PR #77

from django-safedelete.

AndreasBackx avatar AndreasBackx commented on August 16, 2024

@ciarancourtney we're just waiting for a reply from @glemmaPaul and a follow-up commit and squash so it can be merged.

from django-safedelete.

ciarancourtney avatar ciarancourtney commented on August 16, 2024

Actually I'm still getting this error with the latest PR for many of my test cases, mostly any test that gets an a instance like:

MyModel.objects.all()[0]

will give a stacktrace:


  File "/opt/master/venv/lib/python3.6/site-packages/django/db/models/query.py", line 289, in __getitem__
    return list(qs)[0]
  File "/opt/master/venv/lib/python3.6/site-packages/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/opt/master/venv/lib/python3.6/site-packages/safedelete/queryset.py", line 125, in decorator
    self._filter_visibility()
  File "/opt/master/venv/lib/python3.6/site-packages/safedelete/queryset.py", line 100, in _filter_visibility
    "Cannot filter a query once a slice has been taken."
AssertionError: Cannot filter a query once a slice has been taken.

The admin changelist pages that were failing before are fine with the latest PR though

from django-safedelete.

ciarancourtney avatar ciarancourtney commented on August 16, 2024

Replacing all .all()[0] querysets with .first() resolved my test failures. My codebase was originally written in Django 1.3, so I guess before first() was introduced in Django 1.6, it was acceptable to iterate querysets by index?

from django-safedelete.

AndreasBackx avatar AndreasBackx commented on August 16, 2024

@ciarancourtney I was just thinking of that edge case. We should add tests for those as well.

from django-safedelete.

ewen avatar ewen commented on August 16, 2024

I get this error using the Django REST Framework JSON API Pagination alongside safedelete, I guess it takes a slice at the pagination page size. Tested it against PR #77 but still fails.

I think it performs the slice here https://github.com/django/django/blob/master/django/core/paginator.py#L57 as it looks to be using the django.core.paginator.

from django-safedelete.

glemmaPaul avatar glemmaPaul commented on August 16, 2024

@AndreasBackx this might be something we can solve by adding our functionality on the iterator() func, this is getting called when these slices happen.

from django-safedelete.

AndreasBackx avatar AndreasBackx commented on August 16, 2024

@glemmaPaul would adding 'iterator' to the evaluation_methods not do the job then?

from django-safedelete.

elmehalawi avatar elmehalawi commented on August 16, 2024

Any news on this? I'm still experiencing this bug.

from django-safedelete.

AndreasBackx avatar AndreasBackx commented on August 16, 2024

@dublinus See #77

from django-safedelete.

elmehalawi avatar elmehalawi commented on August 16, 2024

@AndreasBackx I swear I tried this before and it didn't work. But it does now, thanks.

Is this PR going to be merged?

from django-safedelete.

elmehalawi avatar elmehalawi commented on August 16, 2024

Love this library, thanks guys.

from django-safedelete.

lanterno avatar lanterno commented on August 16, 2024

I'm getting the same error with earliest, and latest queries. Can someone reopen -needs permission-this issue, or should I create a new one?

  • I'm using version 0.4.3 and tested with django 1.11 and 2.0

@glemmaPaul @Gagaro

from django-safedelete.

glemmaPaul avatar glemmaPaul commented on August 16, 2024

Thanks @Gagaro for the catch up on this, appreciate it a lot!

from django-safedelete.

Gagaro avatar Gagaro commented on August 16, 2024

0.4.4 has been released

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.