Exemple #1
0
def artists():
    """A list of all artists in the database."""
    return render_template(
        'list.html',
        title='Καλλιτέχνες',
        objects=Artist.all(),
        detail_url='main.artist',
        admin=session.get('logged_in'),
    )
Exemple #2
0
def index():
    """Index all data into elasticsearch."""
    elastic.create_index()

    def index_all(items, name):
        with click.progressbar(items, label=f"Indexing {name}") as bar:
            for item in bar:
                elastic.index(item)

    index_all(Song.all(frommetadata=False), 'songs')
    index_all(Artist.all(), 'artists')
    index_all(Scale.all(), 'scales')
Exemple #3
0
 def test_all(self, client):
     SongFactory(name='a', artist='artist_a').tofile()
     SongFactory(name='b', artist='artist_a').tofile()
     SongFactory(name='c', artist='artist_a').tofile()
     SongFactory(name='d', artist='artist_b').tofile()
     assert len(Artist.all()) == 2