Add string representation to image Format() (#6608)

when checking on the currently registered Formats, e.g. with `get_image_formats()` the output is now easier to read.
pull/6624/head
Andreas Nüßlein 2020-12-03 09:33:20 +00:00 zatwierdzone przez Matt Westcott
rodzic ac88310402
commit 6a7a5756d9
3 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -7,6 +7,7 @@ Changelog
* StreamField values can now be modified in-place (Matt Westcott)
* Added support for Python 3.9
* Switch pagination icons to use SVG instead of icon fonts (Scott Cranfill)
* Added string representation to image Format class (Andreas Nüßlein)
* Fix: Stop menu icon overlapping the breadcrumb on small viewport widths in page editor (Karran Besen)
* Fix: Make sure document chooser pagination preserves the selected collection when moving between pages (Alex Sa)

Wyświetl plik

@ -21,6 +21,7 @@ Other features
* Added support for Python 3.9
* Switch pagination icons to use SVG instead of icon fonts (Scott Cranfill)
* Added string representation to image Format class (Andreas Nüßlein)
Bug fixes

Wyświetl plik

@ -13,6 +13,12 @@ class Format:
self.classnames = classnames
self.filter_spec = filter_spec
def __str__(self):
return f'"{self.name}", "{self.label}", "{self.classnames}", "{self.filter_spec}"'
def __repr__(self):
return f"Format({self})"
def editor_attributes(self, image, alt_text):
"""
Return additional attributes to go on the HTML element