Ejemplo n.º 1
0
def createClubAfterApproval(requestentity=None):

        if requestentity:
            newClub = Club()
            newClub.abbreviation = requestentity.abbreviation
            newClub.admin = requestentity.from_pid
            newClub.collegeId = requestentity.collegeId
            newClub.name = requestentity.club_name
            newClub.isAlumni = requestentity.isAlumni
            newClub.description = requestentity.description
            newClub.members.append(requestentity.from_pid)
            newClub.follows.append(requestentity.from_pid)
            newClub.photoUrl = requestentity.photoUrl
            clubkey = newClub.put()

            profile = requestentity.from_pid.get()

            print("To check if profile retrieval is correct ", profile)
            profile.clubsJoined.append(clubkey)

            print("Checking if the  guy has joined the club",profile.clubsJoined)

            profile.follows.append(clubkey)
            print("Check if the profile has folowed the club",profile.follows)

            #adding the club to his admin list

            profile.admin.append(clubkey)

            profile.put()

            college = newClub.collegeId.get()


            if(college):
              college.group_list.append(newClub.key)


              college.put()

        print("finished appending college list")

        return newClub
Ejemplo n.º 2
0
def createClubAfterApproval(requestentity=None):

    if requestentity:
        newClub = Club()
        newClub.abbreviation = requestentity.abbreviation
        newClub.admin = requestentity.from_pid
        newClub.collegeId = requestentity.collegeId
        newClub.name = requestentity.club_name
        newClub.isAlumni = requestentity.isAlumni
        newClub.description = requestentity.description
        newClub.members.append(requestentity.from_pid)
        newClub.follows.append(requestentity.from_pid)
        newClub.photoUrl = requestentity.photoUrl
        clubkey = newClub.put()

        profile = requestentity.from_pid.get()

        print("To check if profile retrieval is correct ", profile)
        profile.clubsJoined.append(clubkey)

        print("Checking if the  guy has joined the club", profile.clubsJoined)

        profile.follows.append(clubkey)
        print("Check if the profile has folowed the club", profile.follows)

        #adding the club to his admin list

        profile.admin.append(clubkey)

        profile.put()

        college = newClub.collegeId.get()

        if (college):
            college.group_list.append(newClub.key)

            college.put()

    print("finished appending college list")

    return newClub