Skip to content

Commit 9534b66

Browse files
committed
Merge branch 'release/1.5'
* release/1.5: Bump version: 1.4.2 → 1.5.0 lint updates CHANGES pass `handler` to permission callable fixes 'confirm_action' Bump version: 1.4.0 → 1.4.1 dj41
2 parents 50a6bf0 + 7595f12 commit 9534b66

File tree

16 files changed

+30
-30
lines changed

16 files changed

+30
-30
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.4.0
2+
current_version = 1.5.0
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
44
serialize = {major}.{minor}.{patch}
55
commit = True

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
python-version: [ "3.9"]
32-
django-version: [ "2.2", "3.2", "4.0" ]
31+
python-version: [ "3.9", "3.10"]
32+
django-version: [ "2.2", "3.2", "4.0", "4.1" ]
3333
env:
3434
PY_VER: ${{ matrix.python-version}}
3535
DJ_VER: ${{ matrix.django-version}}

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
1.5
2+
-----
3+
* pass `handler` to permission callable
4+
5+
16
1.4.2
27
-----
38
* catch OSError when checking decorator

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Three decorators are available:
2020
- ``button()`` to mark a method as extra view and show related button
2121
- ``link()`` This is used for "external" link, where you don't need to invoke local views.
2222
- ``view()`` View only decorator, this adds a new url but do not render any button.
23+
- ``choice()`` Menu like button, can be used to group multiple @views().
2324

2425

2526
Install

setup.cfg

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
[pep8]
2-
ignore = E501,E401,W391,E128,E261,E731
3-
max-line-length = 160
4-
exclude = .tox,migrations,.git,docs,diff_match_patch.py,deploy/**,settings,sheet_template
5-
6-
71
[flake8]
82
max-complexity = 14
93
max-line-length = 120

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def read(*parts):
3535
'pytest-cov',
3636
'pytest-django',
3737
'pytest-echo',
38-
'pytest-pythonpath',
3938
'tox>=2.3',
4039
'wheel',
4140
]
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
default_app_config = 'admin_extra_buttons.apps.Config'
2-
31
NAME = 'django-admin-extra-buttons'
4-
VERSION = __version__ = '1.4.2'
2+
VERSION = __version__ = '1.5.0'
53
__author__ = 'sax'

src/admin_extra_buttons/buttons.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def original(self):
9595
def authorized(self):
9696
if self.handler.permission:
9797
try:
98-
return check_permission(self.handler.permission, self.request, self.original)
98+
return check_permission(self.handler,
99+
self.handler.permission, self.request, self.original)
99100
except PermissionDenied:
100101
return False
101102
return True

src/admin_extra_buttons/handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __call__(self, model_admin, request, *args, **kwargs):
4242
obj = model_admin.get_object(request, pk)
4343

4444
if self.permission:
45-
check_permission(self.permission, request, obj)
45+
check_permission(self, self.permission, request, obj)
4646
elif self.login_required and not request.user.is_authenticated:
4747
raise PermissionDenied
4848

src/admin_extra_buttons/mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def confirm_action(modeladmin, request,
3434
template='admin_extra_buttons/confirm.html',
3535
error_message=None):
3636
opts = modeladmin.model._meta
37-
if extra_context and title:
37+
if extra_context:
3838
title = extra_context.pop('title', title)
3939
context = modeladmin.get_common_context(request,
4040
message=message,
@@ -78,7 +78,7 @@ class ExtraButtonsMixin:
7878
change_form_template = 'admin_extra_buttons/change_form.html'
7979

8080
def __init__(self, model, admin_site):
81-
self.extra_button_handlers = []
81+
self.extra_button_handlers = {}
8282
super().__init__(model, admin_site)
8383

8484
def message_error_to_user(self, request, exception):

0 commit comments

Comments
 (0)