0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Use more concise code for appending to classname

This commit is contained in:
Matt Westcott 2023-09-22 11:34:17 +01:00 committed by Matt Westcott
parent 981ca512e5
commit 240b65f309
2 changed files with 2 additions and 9 deletions

View File

@ -101,11 +101,7 @@ class Button(Component):
# This is also used by SnippetListingButton defined in wagtail.snippets.widgets
class ListingButton(Button):
def __init__(self, label="", url=None, classname="", **kwargs):
if classname:
classname += " button button-small button-secondary"
else:
classname = "button button-small button-secondary"
classname = f"{classname} button button-small button-secondary".strip()
super().__init__(label=label, url=url, classname=classname, **kwargs)

View File

@ -3,8 +3,5 @@ from wagtail.admin.widgets import Button
class UserListingButton(Button):
def __init__(self, label, url, classname="", **kwargs):
if classname:
classname += " button button-small"
else:
classname = "button button-small"
classname = f"{classname} button button-small".strip()
super().__init__(label, url, classname=classname, **kwargs)