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:
parent
981ca512e5
commit
240b65f309
@ -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)
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user