diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 129eb891a4..877e2d5b52 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -63,6 +63,7 @@ Changelog * Fix: Page.copy() no longer copies child objects when the accesssor name is included in `exclude_fields_in_copy` (Karl Hobley) * Fix: Move focus to the pages explorer menu when open (Helen Chapman) * Fix: Clicking the privacy toggle while the page is still loading no longer loads the wrong data in the page (Helen Chapman) + * Fix: Added missing `is_stored_locally` method to `AbstractDocument` (jonny5532) 2.5.1 (07.05.2019) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index a5c74fa4e7..266d62fab5 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -380,6 +380,7 @@ Contributors * Jordan Bauer * Fidel Ramos * Quadric +* jonny5532 Translators =========== diff --git a/docs/releases/2.6.rst b/docs/releases/2.6.rst index 98938bb070..ccd830687e 100644 --- a/docs/releases/2.6.rst +++ b/docs/releases/2.6.rst @@ -94,6 +94,7 @@ Bug fixes * Added missing form media to user edit form template (Matt Westcott) * ``Page.copy()`` no longer copies child objects when the accesssor name is included in ``exclude_fields_in_copy`` (Karl Hobley) * Clicking the privacy toggle while the page is still loading no longer loads the wrong data in the page (Helen Chapman) + * Added missing ``is_stored_locally`` method to ``AbstractDocument`` (jonny5532) Upgrade considerations diff --git a/wagtail/documents/models.py b/wagtail/documents/models.py index c080a53590..c1e2a17f73 100644 --- a/wagtail/documents/models.py +++ b/wagtail/documents/models.py @@ -52,6 +52,17 @@ class AbstractDocument(CollectionMember, index.Indexed, models.Model): index.FilterField('uploaded_by_user'), ] + def is_stored_locally(self): + """ + Returns True if the image is hosted on the local filesystem + """ + try: + self.file.path + + return True + except NotImplementedError: + return False + @contextmanager def open_file(self): # Open file if it is closed