Esempio n. 1
0
    def get(self):

        # Generate login template

        currentUser = users.get_current_user()

        # If the user is logged in...
        if currentUser:

            # Search datastore for a known_user of their email
            email_address = currentUser.nickname()
            user = User.query().filter(User.email == email_address).get()

            # If the user is registered...
            if user:

                # Redirect user to home page
                self.redirect("/home", True)

            else:

                self.response.write(
                    renderPage("templates/login.html", {"notKnownUser": True}))

        else:
            # If the user isn't logged in...
            login_url = users.create_login_url('/')

            # Prompt the user to sign in.
            self.response.write(
                renderPage("templates/login.html", {
                    "notLoggedIn": True,
                    "login_url": login_url
                }))
Esempio n. 2
0
    def get(self):

        user = GetUserInfo()

        orgs, events = [], []

        for org_key in user.organizations:
            org = org_key.get()
            orgs.append({"name": org.name, "url": org.name.replace(" ", "_")})

        for e in EventsGivenUser(user):

            thisLeague = LeagueGivenEvent(e)
            thisOrg = OrgGivenLeague(thisLeague)

            events.append({
                "name": e.name,
                "time": e.time,
                "league": thisLeague,
                "org": thisOrg
            })

        print events

        self.response.write(
            renderPage('templates/home.html', {
                "orgs": orgs,
                "events": events
            }, "Home", self.request.url, True))
Esempio n. 3
0
    def get(self):

        orgs = Organization.query().fetch()

        self.response.write(
            renderPage("templates/find-orgs.html", {"orgs": orgs}, "Find Orgs",
                       self.request.url, True))
Esempio n. 4
0
    def get(self):

        users = []

        for user in UsersGivenEvent(GetCurrentEvent(self.request.url)):
            users.append(user)

        self.response.write(
            renderPage("templates/event.html", {"members": users}, "",
                       self.request.url, True, True, True, True))
Esempio n. 5
0
    def get(self):

        user = GetProfileUser(self.request.url)

        user_orgs = AllUserInfo(user)

        print user_orgs

        self.response.write(
            renderPage("templates/profile.html", {
                "user": user,
                "user_orgs": user_orgs,
            }, user.user_name, self.request.url, True))
Esempio n. 6
0
    def get(self):

        org = GetCurrentOrg(self.request.url)
        league = GetCurrentLeague(self.request.url)
        members, events = [], []

        for event in league.events:
            events.append(event.get())

        for member in UsersGivenLeague(league):
            members.append(member)

        self.response.write(
            renderPage(
                "templates/league.html", {
                    "org_url": org.name.replace(" ", "_"),
                    "league_url": league.name.replace(" ", "_"),
                    "members": members,
                    "events": events
                }, "", self.request.url, True, True, True))
Esempio n. 7
0
    def get(self):

        org = GetCurrentOrg(self.request.url)
        leagues, league_links, members = [], [], []

        user = GetUserInfo()

        for league in org.leagues:
            leagueObject = league.get()
            leagues.append(leagueObject)
            league_links.append(leagueObject.name.replace(" ", "_"))

        for member in UserGivenOrganization(org):
            members.append(member)
            print member

        self.response.write(
            renderPage(
                "templates/org.html", {
                    "leagues": leagues,
                    "league_links": league_links,
                    "members": members
                }, "", self.request.url, True, True))
Esempio n. 8
0
    def get(self):

        self.response.write(
            renderPage("templates/create-event.html", {}, "Create Event",
                       self.request.url, True, True, True))
Esempio n. 9
0
 def get(self):
     self.response.write(
         renderPage("templates/create-league.html", {}, "Create League",
                    self.request.url, True, True))
Esempio n. 10
0
    def get(self):

        self.response.write(
            renderPage("templates/create-org.html", {}, "Create Org",
                       self.request.url, True))