def get_available_art_by_artist(artist): """ Get a list of art by artist that matches search term and art is aviailable :param term(the user input) :returns list of art by artist that is available """ available_art = Artwork.select().where( (Artwork.art_available == True) & (Artwork.artist == artist)) return available_art
def get_all_artwork_of_artist(name):#returning all artwork by artist try: artwork_list = [] for art in Artwork.select().join(Artist).where(Artist.name == Artwork.artist): artwork_list.append(Artwork.name) return ', '.join(artwork_list) except: print('no found an art')
def get_available_artwork_of_artist(name):#returnig all available artwork by artist artwork_list = [] for art in Artwork.select().join(Artist).where( (Artist.name == artist) & (Artwork.available == True)): artwork_list.append(art.Artwork.name) return ', '.join(artwork_list)
def search_artist_artwork(term): # search for all the artwork by an artist (everything - available and sold) query = Artwork.select().where((Artwork.artist).contains(term.lower())) return list(query)
def all_available_art(): # display for all the available artwork by an artist available_art = Artwork.select().where( Artwork.available == True) & (Artwork.artist == artist) for artworks in available_art: return artworks
def artist_art_search(term): query = Artwork.select().where( ( fn.LOWER(Artwork.artist).contains(term.lower() ) ) ) return list(query)
def artwork_count(): return Artwork.select().count()
def get_all_artwork(): query = Artwork.select() return list(query)
def get_artwork_by_sold_value(sold): query = Artwork.select().where(Artwork.sold == sold) return list(query)
def get_artwork_by_available_value(available): query = Artwork.select().where(Artwork.available == available) return list(query)
def search_artwork(term): query = Artwork.select().where((fn.LOWER(Artwork.artwork_name).contains(term.lower()))) return list(query)