예제 #1
0
    def get(self):
        self.auth()
        user = self.current_user()

        circles = Circle().all().fetch(None)

        n = Notifications()

        notifications = n.get_all(None, user)

        for circle in circles:
            if circle.key() in user.circles:
                circle.user = True
            else:
                circle.user = False

        doRender(self, 'home.html', { 
            'site_notis': notifications,
            'user': user,
            'circles': circles
        })
예제 #2
0
    def get(self):
        self.auth()
        user = self.current_user()

        circles = Circle().all().fetch(None)

        n = Notifications()

        notifications = n.get_all(None, user)

        for circle in circles:
            if circle.key() in user.circles:
                circle.user = True
            else:
                circle.user = False

        doRender(self, 'home.html', {
            'site_notis': notifications,
            'user': user,
            'circles': circles
        })
예제 #3
0
    def get(self, circle_id):
        self.auth()

        circle = Circle.get_by_id(int(circle_id))

        if not circle:
            self.session['circle'] = None
            self.redirect('/circles')
            return None

        self.session['circle'] = circle.key().id()

        user = self.current_user()

        today = date.today()

        n = Notifications()
        notifications = n.get_all(circle, user)

        requests = User.all().filter('__key__ in', circle.requests).fetch(100)

        notis = Notification.all().filter('circle = ', circle.key()).filter('type = ', 'circle_message').filter('created >', today).fetch(100)

        members = User.all().filter('circles =', circle.key()).fetch(None)
        admins = User.all().filter('__key__ in', circle.admins).fetch(None)

        for noti in notis:
            noti.date_str = noti.created.strftime('%B %dth, %Y')

        if circle.key() in user.circles:
            has_permission = True
        else:
            has_permission = False

        invite = Invite.all().filter('circle = ', circle.key()).filter('user = '******'/circles')

        today = date.today()

        events_all = Event.all().filter('circle =', circle).filter('date >=', today).fetch(100)

        for event in events_all:
            event.date_str = event.date.strftime('%B %dth, %Y')

        doRender(self, 'view_circle.html', {
            'circle': circle,
            'user': user,
            'invite': invite,
            'is_admin': is_admin,
            'requests': requests,
            'notis': notis,
            'events_all': events_all,
            'members': members,
            'admins': admins,
            'total_members': len(members),
            'site_notis': notifications
        })
예제 #4
0
    def get(self, circle_id):
        self.auth()

        circle = Circle.get_by_id(int(circle_id))

        if not circle:
            self.session['circle'] = None
            self.redirect('/circles')
            return None

        self.session['circle'] = circle.key().id()

        user = self.current_user()

        today = date.today()

        n = Notifications()
        notifications = n.get_all(circle, user)

        requests = User.all().filter('__key__ in', circle.requests).fetch(100)

        notis = Notification.all().filter('circle = ', circle.key()).filter(
            'type = ', 'circle_message').filter('created >', today).fetch(100)

        members = User.all().filter('circles =', circle.key()).fetch(None)
        admins = User.all().filter('__key__ in', circle.admins).fetch(None)

        for noti in notis:
            noti.date_str = noti.created.strftime('%B %dth, %Y')

        if circle.key() in user.circles:
            has_permission = True
        else:
            has_permission = False

        invite = Invite.all().filter('circle = ', circle.key()).filter(
            'user = '******'/circles')

        today = date.today()

        events_all = Event.all().filter('circle =',
                                        circle).filter('date >=',
                                                       today).fetch(100)

        for event in events_all:
            event.date_str = event.date.strftime('%B %dth, %Y')

        doRender(
            self, 'view_circle.html', {
                'circle': circle,
                'user': user,
                'invite': invite,
                'is_admin': is_admin,
                'requests': requests,
                'notis': notis,
                'events_all': events_all,
                'members': members,
                'admins': admins,
                'total_members': len(members),
                'site_notis': notifications
            })