Comments (20)
0.4.2 has been released with the fix.
from django-safedelete.
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.
@ewen we are aware of the issue and it'll get fixed in #77 as well.
from django-safedelete.
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.
Does it work with the PR #77 ?
from django-safedelete.
@Gagaro I was getting this error for only some models in Django 1.11, error disappeared when I used PR #77
from django-safedelete.
@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.
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.
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.
@ciarancourtney I was just thinking of that edge case. We should add tests for those as well.
from django-safedelete.
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.
@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.
@glemmaPaul would adding 'iterator'
to the evaluation_methods
not do the job then?
from django-safedelete.
Any news on this? I'm still experiencing this bug.
from django-safedelete.
@dublinus See #77
from django-safedelete.
@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.
Love this library, thanks guys.
from django-safedelete.
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
from django-safedelete.
Thanks @Gagaro for the catch up on this, appreciate it a lot!
from django-safedelete.
0.4.4 has been released
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.