Example #1
0
def add_album_with_contributor(title, username):
    """
    Used when creating the album, as it needs to be related to the creator
    """
    album = Album(title=title)    
    album.save()
    ContributorAlbum(slug=album.slug, username=username).save()
    return album    
Example #2
0
def add_contributor_album(slug, username):
    """
    Used when adding an existent contributor to an existent album
    """
    contrib = Contributor.get(username)
    album = Album.get(slug)
    ContributorAlbum(slug=album.slug, username=contrib.username).save()
Example #3
0
def get_albums_by_username(username):
    
    return [Album.get(calbum.slug) for calbum in ContributorAlbum.scan({"username": condition.EQ(username)})]
        
    
Example #4
0
def get_album_by_slug(slug):
    return Album.get(slug)
Example #5
0
def get_album_by_title(title):
    gen = Album.scan({"title": condition.EQ(title)})
    for data in gen: return data