Beispiel #1
0
def get_requests(user_key):
    """Query to return the list of requests that this user sent to institutions."""
    institutions_requested = []
    queryRequests = RequestUser.query(RequestUser.sender_key == user_key,
                                      RequestUser.status == 'sent')
    institutions_requested = [
        request.institution_key.urlsafe() for request in queryRequests
    ]

    return institutions_requested
Beispiel #2
0
    def get(self, user, institution_key):
        """Get all requests which type is user and
        the institution_key is equals to the institution_key
        received as param. Only the sent requests.
        """
        queryRequests = RequestUser.query(
            RequestUser.institution_key == ndb.Key(urlsafe=institution_key),
            RequestUser.status == 'sent')

        requests = [request.make() for request in queryRequests]

        self.response.write(json.dumps(requests))