Skip to content

Commit

Permalink
Merge pull request #1 from dmarychev/avoid-unnecessary-django-cache-i…
Browse files Browse the repository at this point in the history
…nvalidation

avoid unnecessary cache invalidation of a django queryset
  • Loading branch information
nnseva authored Jan 25, 2024
2 parents f452767 + 9c9d2bd commit 1d6c713
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
max-parallel: 2
matrix:
include:
- python-version: "2.7"
toxenv: py27-django{1.10,1.11}
- python-version: "3.6"
toxenv: py36-django{1.10,1.11,2.0,2.1,2.2,3.0}
- python-version: "3.7"
Expand Down
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: python
matrix:
include:
- python: 2.7
env: TOXENV="py27--django{1.11},flake8"
- python: 3.6
env: TOXENV="py36--django{1.11,2.0,2.1,2.2,3.0}"
- python: 3.7
Expand Down
2 changes: 1 addition & 1 deletion access_tastypie/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.0b1"
__version__ = "0.1.0b2"
4 changes: 3 additions & 1 deletion access_tastypie/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def read_detail(self, object_list, bundle):
if self.check_able('visible', object_list.model, bundle.request) is False:
return False
if bundle.obj and bundle.obj.pk:
return bool(self.apply_able('visible', object_list.filter(pk=bundle.obj.pk), bundle.request))
# Read_detail() will always receive a queryset with a single object, no need
# to filter it once again. This preserves any cache inside object_list.
return bool(self.apply_able('visible', object_list, bundle.request))
return True

def update_list(self, object_list, bundle):
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
Expand Down

0 comments on commit 1d6c713

Please sign in to comment.