def show_all_available(): artworks = Artwork.select().where(Artwork.sold == False) if artworks: for artwork in artworks: ui.display(format_artwork(artwork)) else: ui.display('No artwork found')
def get_all_available_artwork(artist_id_in): try: return Artwork.select().where(Artwork.artist_id == artist_id_in, Artwork.available == 1) except DatabaseError: #as de: #return de return 'Sorry. There was an error retrieving the artwork'
def get_all_artwork(artist_id_in): try: return Artwork.select().join( Artist, on=(Artist.artist_id == Artwork.artist_id)).where( Artwork.artist_id == artist_id_in) except DatabaseError: #as de: #return de return 'Sorry. There was an error retrieving the artwork'
def show_all_available_by_artist(): artist_control.show_all() artist = artist_control.get_by_id() artworks = Artwork.select().where(Artwork.sold == False, Artwork.artist == artist) if artworks: for artwork in artworks: ui.display(format_artwork(artwork)) else: ui.display('No artwork found')
def get_all_artwork(): artwork = Artwork.select() return artwork
def search_available_by_artist(name): artworks = Artwork.select().join(Artist).where((Artist.name == name) & (Artwork.available == True)) return artworks
def search_artwork_by_artist(name): artworks = Artwork.select().join(Artist).where(Artist.name == name) return artworks
def show_all(): artworks = Artwork.select() for artwork in artworks: ui.display(format_artwork(artwork))