Skip to content

Commit 37434e4

Browse files
committed
Merge branch 'release/1.5.8'
* release/1.5.8: bump version updates tox/ci updates tox/ci fixes permission check add common css class Update button documentation example to call `get_object` correctly
2 parents b24d269 + 2ff6de9 commit 37434e4

File tree

13 files changed

+36
-21
lines changed

13 files changed

+36
-21
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.5.7
2+
current_version = 1.5.8
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
44
serialize = {major}.{minor}.{patch}
55
commit = False

.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", "3.10", "3.11"]
32-
django-version: [ "3.2", "4.2"]
31+
python-version: [ "3.11", "3.12"]
32+
django-version: [ "3.2", "4.2", "5.0"]
3333
env:
3434
PY_VER: ${{ matrix.python-version}}
3535
DJ_VER: ${{ matrix.django-version}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ pytest.xml
1515
*.sqlite
1616
dist/*
1717
docs/site
18+
stubs/

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.5.8
2+
-----
3+
* add common css class
4+
* fixes permissions check
5+
6+
17
1.5.7
28
-----
39
* BUG FIX: fixes check() implementation

MANIFEST.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
include README.rst
1+
include README.md
22
include CHANGES
33
include LICENSE
44
include MANIFEST.in
55
include tox.ini
66
include setup.py
77
include setup.cfg
88

9+
global-include *.pyi
10+
global-include *.typed
11+
912
include tests/.coveragerc
1013
recursive-include src/requirements *.pip
1114
recursive-include docs *

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
django-admin-extra-buttons
1+
django-admin-extra-buttons
22
==========================
33

44

@@ -48,26 +48,28 @@ from django.contrib import admin
4848
from django.views.decorators.clickjacking import xframe_options_sameorigin
4949
from django.views.decorators.csrf import csrf_exempt
5050

51+
5152
class MyModelModelAdmin(ExtraButtonsMixin, admin.ModelAdmin):
5253

5354
@button(permission='demo.add_demomodel1',
55+
visible=lambda self: self.context["request"].user.is_superuser,
5456
change_form=True,
5557
html_attrs={'style': 'background-color:#88FF88;color:black'})
5658
def refresh(self, request):
5759
self.message_user(request, 'refresh called')
5860
# Optional: returns HttpResponse
5961
return HttpResponseRedirectToReferrer(request)
60-
62+
6163
@button(html_attrs={'style': 'background-color:#DC6C6C;color:black'})
6264
def confirm(self, request):
6365
def _action(request):
6466
pass
6567

6668
return confirm_action(self, request, _action, "Confirm action",
67-
"Successfully executed", )
69+
"Successfully executed", )
6870

69-
@link(href=None,
70-
change_list=False,
71+
@link(href=None,
72+
change_list=False,
7173
html_attrs={'target': '_new', 'style': 'background-color:var(--button-bg)'})
7274
def search_on_google(self, button):
7375
original = button.context['original']
@@ -87,7 +89,7 @@ class MyModelModelAdmin(ExtraButtonsMixin, admin.ModelAdmin):
8789
if request.method == "POST":
8890
return HttpResponse("POST")
8991
return HttpResponse("GET")
90-
92+
9193

9294
```
9395

docs/api/button.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Buttons with custom permission, one for `change_list` and other for `change_form
106106

107107
@button(permission='app.delete_mymodel)
108108
def mark(self, request, pk):
109-
obj = self.get_object(request.pk)
109+
obj = self.get_object(request, pk)
110110
obj.mark = True
111111
obj.save()
112112

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ balanced_wrapping = true
2525
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
2626

2727
[metadata]
28-
license-file = LICENSE
28+
license_file = LICENSE
2929

3030
[wheel]
3131
universal = 1

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def read(*parts):
4444
'django',
4545
'pip-tools',
4646
'flake8',
47+
'mypy',
4748
'pep8',
4849
'readme',
4950
'sphinx',

src/admin_extra_buttons/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
NAME = 'django-admin-extra-buttons'
2-
VERSION = __version__ = '1.5.7'
2+
VERSION = __version__ = '1.5.8'
33
__author__ = 'sax'

0 commit comments

Comments
 (0)