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()
def get_album_contributors(album): return [Contributor.get(x.username) for x in ContributorAlbum.scan({"slug": condition.EQ(album.slug)})]
def delete_contributor_by_username(username): Contributor.get(username).delete() [x.delete() for x in ContributorAlbum.scan({"username": condition.EQ(username)})]
def get_contributor_by_username(username): return Contributor.get(username)