コード例 #1
0
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
コード例 #2
0
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