def copyPostRequestToForm(request): reply = GetPostRequestsForm() for field in reply.all_fields(): print field if(hasattr(request,field.name)): setattr(reply,field.name,str(getattr(request,field.name))) elif(field.name=="from_name"): person = request.from_pid.get().name setattr(reply,field.name,person) elif(field.name=="club_name"): club = request.club_id.get().name setattr(reply,field.name,club) elif field.name == 'timestamp': setattr(reply, field.name, str(request.timestamp)) elif field.name == "post_name": setattr(reply, field.name, request.title) elif(field.name == "from_photoUrl"): from_photoUrl = request.from_pid.get().photoUrl setattr(reply,field.name,from_photoUrl) else: setattr(reply,"postRequestId",str(request.key.id())) return reply
def copyPostRequestToForm(request): reply = GetPostRequestsForm() for field in reply.all_fields(): print field if(hasattr(request,field.name)): setattr(reply,field.name,str(getattr(request,field.name))) elif(field.name=="person_from"): person = request.from_pid.get().name setattr(reply,field.name,person) elif(field.name=="club_name"): club = request.club_id.get().name setattr(reply,field.name,club) else: setattr(reply,"postRequestId",str(request.key.id())) return reply