示例#1
0
def new_album():
    artists = artist_repository.select_all()
    labels = label_repository.select_all()
    genres = genre_repository.select_all()
    return render_template("albums/new.html",
                           artists=artists,
                           labels=labels,
                           genres=genres)
示例#2
0
def edit_album(id):
    album = album_repository.select(id)
    artists = artist_repository.select_all()
    genres = genre_repository.select_all()
    labels = label_repository.select_all()
    return render_template("albums/edit.html",
                           album=album,
                           artists=artists,
                           genres=genres,
                           labels=labels)
示例#3
0
album_repository.delete_all()
artist_repository.delete_all()

artist1 = Artist("ABBA")
artist_repository.save(artist1)
artist2 = Artist("Fleetwood Mac")
artist_repository.save(artist2)

album1 = Album("Greatest Hits", "Pop", artist1)
album_repository.save(album1)
album2 = Album("Rumours", "Classic Rock", artist2)
album_repository.save(album2)
album3 = Album("Voulez-Vous", "Pop", artist1)
album_repository.save(album3)

artists = artist_repository.select_all()

album1.title = "Greatest Hits Vol. 2"
album_repository.update(album1)

found_album = album_repository.select(album2.id)
print(found_album.artist.__dict__)

found_albums = artist_repository.albums(artist1)
for album in found_albums:
    print(album.__dict__)

album_repository.delete(album3.id)

albums = album_repository.select_all()
for album in albums:
示例#4
0
def artists(
):  # Add something that deactivates artist link if no albums in stock?
    artists = artist_repository.select_all()
    return render_template("artists/index.html", artists=artists)
def edit_album(id):
    album = album_repository.select(id)
    artists = artist_repository.select_all()
    return render_template("albums/edit.html", album = album, artists = artists)
def create_album():
    artists = artist_repository.select_all()
    return render_template("albums/create.html", artists = artists)
示例#7
0
def artists():
    artists = artist_repository.select_all()
    return render_template("artists/index.html", artists=artists)