def collection(self): collection_uri = self.rels_ext.content.value( subject=self.uriref, predicate=rdfns.relsext.isMemberOfCollection) if collection_uri: return CollectionObject( self.api, str(collection_uri).replace('info:fedora/', ''))
def list_collections(request): """list all collections in repository returns list of :class:`~genrepo.collection.models.CollectionObject` """ colls = CollectionObject.all() colls = list(accessible(colls)) colls.sort(key=lambda coll: coll.label.upper()) # sort based on label return render(request, "collection/list.html", {"colls": colls})
def list_collections(request): '''list all collections in repository returns list of :class:`~genrepo.collection.models.CollectionObject` ''' colls = CollectionObject.all() colls = list(accessible(colls)) colls.sort(key=lambda coll: coll.label.upper()) # sort based on label return render(request, 'collection/list.html', {'colls': colls})
def test_all(self): with patch('genrepo.collection.models.Repository') as mockrepo: CollectionObject.all() mockrepo().get_objects_with_cmodel.assert_called_with( CollectionObject.COLLECTION_CONTENT_MODEL, type=CollectionObject)
def setUp(self): # use an in-ingested collection object with a mock API for now (until we need more) self.coll = CollectionObject(Mock())
def _collection_options(): collections = list(accessible(CollectionObject.all())) options = [('', '')] + \ [ ('info:fedora/' + c.pid, c.label or c.pid) for c in collections ] return options