def performEdit(request, editActivity):
    if request.form['name']:
        editActivity.name = request.form['name']
    if request.form['image']:
        editActivity.image = request.form['image']
    if request.form['location']:
        editActivity.location = request.form['location']

    # datetime info
    datetime = checkBox.checkDateTime(editActivity, request)
    editActivity.datetime = datetime

    [
        tag_free, tag_sporty, tag_outdoor, tag_special, tag_learn,
        tag_date_night, tag_over_21, tag_after_work
    ] = checkBox.checkTags(request)

    editActivity.tag_free = tag_free
    editActivity.tag_sporty = tag_sporty
    editActivity.tag_outdoor = tag_outdoor
    editActivity.tag_special = tag_special
    editActivity.tag_learn = tag_learn
    editActivity.tag_date_night = tag_date_night
    editActivity.tag_over_21 = tag_over_21
    editActivity.tag_after_work = tag_after_work

    return editActivity
def createInvite(activity, request, guest_id, invite_key):
    [tag_free, tag_sporty, tag_outdoor, tag_special, tag_learn,
     tag_date_night, tag_over_21, tag_after_work] = checkBox.checkTags(request)

    newInvite = Invite(
        host=login_session['user_id'],
        guest=guest_id,
        invite_key=invite_key,
        tag_free=tag_free,
        tag_sporty=tag_sporty,
        tag_outdoor=tag_outdoor,
        tag_special=tag_special,
        tag_learn=tag_learn,
        tag_date_night=tag_date_night,
        tag_over_21=tag_over_21,
        tag_after_work=tag_after_work,
        )

    newInvite.name = activity.name
    newInvite.image = activity.image
    newInvite.location = activity.location
    newInvite.description = activity.description
    newInvite.datetime = activity.datetime

    newInvite.message = "Hey Pals! Who is down for this awesome activity?"

    if request.form['name']:
        newInvite.name = request.form['name']
    if request.form['image']:
        newInvite.image = request.form['image']
    if request.form['location']:
        newInvite.location = request.form['location']
    if request.form['message']:
        newInvite.message = request.form['message']
    if request.form['description']:
        newInvite.message = request.form['description']

    datetime = checkBox.checkDateTime(newInvite, request)
    newInvite.datetime = datetime

    return newInvite
def createActivity(request):

    [
        tag_free, tag_sporty, tag_outdoor, tag_special, tag_learn,
        tag_date_night, tag_over_21, tag_after_work
    ] = checkBox.checkTags(request)

    fullNameString = request.form['name'] + " @ " + request.form['location']
    newActivity = Activity(
        name=request.form['name'],
        location=request.form['location'],
        fullName=fullNameString,
        image=request.form['image'],
        description=request.form['description'],
        creator=login_session['user_id'],
        tag_free=tag_free,
        tag_sporty=tag_sporty,
        tag_outdoor=tag_outdoor,
        tag_special=tag_special,
        tag_learn=tag_learn,
        tag_date_night=tag_date_night,
        tag_over_21=tag_over_21,
        tag_after_work=tag_after_work,
    )

    if request.form['venue_id']:
        newActivity.venue_id = request.form['venue_id']
    if request.form['lat']:
        newActivity.lat = request.form['lat']
    if request.form['lng']:
        newActivity.lng = request.form['lng']

    datetime = checkBox.checkDateTime(newActivity, request)
    newActivity.datetime = datetime

    flash("New Activity Successfully Created: %s" % newActivity.name)
    return newActivity