# Path: classphoto/db.py
# class UserBio(models.Model):


from classphoto import db
import datetime
import string
    # delete any previous bios
    if db.UserBio.objects.filter(email=email, date_deleted__isnull=True).exists():
        pending_bio = db.UserBio.objects.get(email=email, date_deleted__isnull=True)
        pending_bio.date_deleted = now
        pending_bio.save()

    bio_db = db.UserBio()
    bio_db.email = email
    bio_db.sequence = sequence
    bio_db.name = name
    bio_db.bio = bio
    bio_db.avatar = avatar
    bio_db.twitter = twitter
    bio_db.gplus = gplus
    bio_db.date_added = now
    bio_db.date_updated = now
    bio_db.save()
    return _bio2dict(bio_db)


def has_bio( email, sequence ):
    bios_db = db.UserBio.objects.filter(
        email=email,
        sequence=sequence,
        date_deleted__isnull=True
    )
    return bios_db.exists()


def get_bio( email ):

# Path: classphoto/db.py
# class UserBio(models.Model):


# Path: classphoto/models.py
from classphoto import db
import datetime
import string

    # delete any previous bios
    if db.UserBio.objects.filter(email=email, date_deleted__isnull=True).exists():
        pending_bio = db.UserBio.objects.get(email=email, date_deleted__isnull=True)
        pending_bio.date_deleted = now
        pending_bio.save()

    bio_db = db.UserBio()
    bio_db.email = email
    bio_db.sequence = sequence
    bio_db.name = name
    bio_db.bio = bio
    bio_db.avatar = avatar
    bio_db.twitter = twitter
    bio_db.gplus = gplus
    bio_db.date_added = now
    bio_db.date_updated = now
    bio_db.save()
    return _bio2dict(bio_db)


def has_bio( email, sequence ):
    bios_db = db.UserBio.objects.filter(
        email=email,
        sequence=sequence,
        date_deleted__isnull=True
    )
    return bios_db.exists()


def get_bio( email ):

    bios_db = db.UserBio.objects.filter(