Example #1
0
def create_club(name, description):
    new_club = Club(
        name=name,
        description=description
    )
    db.session.add(new_club)
    db.session.commit()
    return new_club.serialize()
Example #2
0
def create_club():
    post_body = json.loads(request.data)
    name = post_body.get('name', '')
    description = post_body.get('description', '')
    club = Club(name=name, description=description)
    db.session.add(club)
    db.session.commit()
    return json.dumps({'success': True, 'data': club.serialize()}), 200
def edit_club(club_id):
    contents = json.loads(request.data)
    club = Club(name=contents.get('name'),
                description=contents.get('description'))
    club.officers.append(user)
    club.users.append(user)
    db.session.add(club)
    db.session.commit()
    return json.dumps({
        'success': True,
        'data': club.officers_serialize()
    }), 201
def create_club():
    contents = json.loads(request.data)
    # user = User.query.filter_by(id=user_id).first()
    club = Club(name=contents.get('name'),
                description=contents.get('description'))
    # club.officers.append(user)
    # club.users.append(user)
    db.session.add(club)
    db.session.commit()
    return json.dumps({
        'success': True,
        'data': club.officers_serialize()
    }), 201
Example #5
0
def create_club():
    post_body = json.loads(request.data)
    name = post_body.get('name')
    description = post_body.get('description', '')
    level = post_body.get('level')
    application_required = post_body.get('application_required', None)
    category = post_body.get('category')
    href = post_body.get('href', None)
    club = Club(name=name,
                description=description,
                level=level,
                application_required=application_required,
                category=category,
                href=href)
    db.session.add(club)
    db.session.commit()
    return json.dumps({'success': True, 'data': club.serialize()}), 201
Example #6
0
def create_club():
    body = json.loads(request.data)
    name = body['name']
    website = body['website']
    portal = body['portal']
    status = body['status']

    club = Club(
        name=name,
        website=website,
        portal=portal,
        status=status,
    )
    db.session.add(club)
    db.session.commit()

    return json.dumps({"Success": True, "data": club.serialize()}), 201
Example #7
0
def create_club(body):
    club = Club(body)

    db.session.add(club)
    db.session.commit()
    return club.serialize()