Skip to content

Commit

Permalink
Merge branch 'release/1.5.4'
Browse files Browse the repository at this point in the history
* release/1.5.4:
  updates CHANGES
  Bump version: 1.5.3 → 1.5.4
  add tests
  allow write visbile property
  updates Makefile
  • Loading branch information
saxix committed Sep 15, 2022
2 parents 91201b1 + 19eb271 commit 3cb7200
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.5.3
current_version = 1.5.4
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
serialize = {major}.{minor}.{patch}
commit = True
Expand Down
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
1.5.4
-----
* allow overwrite visible inside handler


1.5.3
-----
* bug fixing
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ develop:

clean:
# cleaning
@rm -fr dist '~build' .pytest_cache .coverage src/admin_extra_buttons.egg-info
@rm -fr dist '~build' coverage.xml pytest.xml .*.sqlite .pytest_cache .coverage src/django_admin_extra_buttons.egg-info
@find . -name __pycache__ -o -name .eggs | xargs rm -rf
@find . -name "*.py?" -o -name ".DS_Store" -o -name "*.orig" -o -name "*.min.min.js" -o -name "*.min.min.css" -prune | xargs rm -rf

Expand Down
2 changes: 1 addition & 1 deletion src/admin_extra_buttons/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NAME = 'django-admin-extra-buttons'
VERSION = __version__ = '1.5.3'
VERSION = __version__ = '1.5.4'
__author__ = 'sax'
4 changes: 4 additions & 0 deletions src/admin_extra_buttons/buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def visible(self):

return self._visible

@visible.setter
def visible(self, value):
self._visible = value

@property
def request(self):
if not self.context: # pragma: no cover
Expand Down
4 changes: 4 additions & 0 deletions tests/demoapp/demo/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def disabled(self, request):
def enabled(self, request):
pass

@link(href="https://www.google.com/", visible=lambda btn: True)
def invisible(self, button):
button.visible = False

@button()
def error_message(self, request):
try:
Expand Down
7 changes: 7 additions & 0 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.urls import reverse


def test_admin(app, admin_user):
url = reverse('admin:demo_demomodel1_changelist')
res = app.get(url, user=admin_user)
assert res.status_code == 200

0 comments on commit 3cb7200

Please sign in to comment.