diff --git a/apps/iiif/kollections/models.py b/apps/iiif/kollections/models.py index af9da0e8..77ca5e8c 100644 --- a/apps/iiif/kollections/models.py +++ b/apps/iiif/kollections/models.py @@ -67,7 +67,7 @@ def autocomplete_label(self): return self.label def __str__(self): - return self.label + return str(self.label) def get_absolute_url(self): """Concatenated property for collection's URI""" @@ -95,7 +95,8 @@ def __make_thumbnail(self): size = (400, 500) image = Image.open(self.thumbnail) - # We need to test that this if else works correctly so that new files can be uploaded and existing files are not renamed. + # We need to test that this if else works correctly so that new files can be + # uploaded and existing files are not renamed. if 'thumbnails/' in self.thumbnail.name: return True else: @@ -138,6 +139,7 @@ def __make_thumbnail(self): temp_thumb.seek(0) # set save=False, otherwise it will run in an infinite loop + # pylint: disable = no-member self.thumbnail.save(thumb_filename, ContentFile(temp_thumb.read()), save=False) temp_thumb.close() return True @@ -211,6 +213,7 @@ def __make_header(self): temp_header.seek(0) # set save=False, otherwise it will run in an infinite loop + # pylint: disable = no-member self.header.save(thefilename, ContentFile(temp_header.read()), save=False) temp_header.close() diff --git a/apps/iiif/manifests/tests/test_documents.py b/apps/iiif/manifests/tests/test_documents.py index 7be4f88e..02b5d79c 100644 --- a/apps/iiif/manifests/tests/test_documents.py +++ b/apps/iiif/manifests/tests/test_documents.py @@ -104,13 +104,14 @@ def test_get_queryset(self): assert prefetched['collections'].count() == 1 assert prefetched['collections'].first().pk == collection.pk - def test_get_instances_from_related(self): - """Should get manifests from related collections""" - manifest = ManifestFactory.create() - # connect a collection and manifest - collection = Collection(label="test collection") - collection.save() - manifest.collections.add(collection) - instances = self.doc.get_instances_from_related(related_instance=collection) - # should get the manifest related to this collection - self.assertQuerysetEqual(instances, [manifest]) + # Removed test because we don't want to trigger a re-index when a collection is saved. + # def test_get_instances_from_related(self): + # """Should get manifests from related collections""" + # manifest = ManifestFactory.create() + # # connect a collection and manifest + # collection = Collection(label="test collection") + # collection.save() + # manifest.collections.add(collection) + # instances = self.doc.get_instances_from_related(related_instance=collection) + # # should get the manifest related to this collection + # self.assertQuerysetEqual(instances, [manifest])