Beispiel #1
0
def main_view(request):
    hitpct = Idea.ideas_bunch(Idea.hit_percentage.desc())
    top = Idea.ideas_bunch(Idea.hits.desc())
    bottom = Idea.ideas_bunch(Idea.misses.desc())
    last10 = Idea.ideas_bunch(Idea.idea_id.desc())

    toplists = [
        {
            'title': 'Latest shots',
            'items': last10
        },
        {
            'title': 'Most hits',
            'items': top
        },
        {
            'title': 'Most misses',
            'items': bottom
        },
        {
            'title': 'Best performance',
            'items': hitpct
        },
    ]

    login_form = login_form_view(request)

    return {
        'username': authenticated_userid(request),
        'toolbar': toolbar_view(request),
        'cloud': cloud_view(request),
        'latest': latest_view(request),
        'login_form': login_form,
        'toplists': toplists,
    }
Beispiel #2
0
    def test_ideas_bunch(self):
        from shootout.models import Idea

        user = self._addUser()
        idea1 = self._addIdea(user=user)
        idea2 = self._addIdea(user=user, title=u"title3")
        idea3 = self._addIdea(user=user, title=u"title4")
        idea4 = self._addIdea(user=user, title=u"title2")

        self.assertEqual(Idea.ideas_bunch(Idea.idea_id), [idea1, idea2, idea3, idea4])
        self.assertEqual(Idea.ideas_bunch(Idea.idea_id, 2), [idea1, idea2])
        self.assertEqual(Idea.ideas_bunch(Idea.title), [idea1, idea4, idea2, idea3])
Beispiel #3
0
    def test_ideas_bunch(self):
        from shootout.models import Idea
        user = self._addUser()
        idea1 = self._addIdea(user=user)
        idea2 = self._addIdea(user=user, title=u'title3')
        idea3 = self._addIdea(user=user, title=u'title4')
        idea4 = self._addIdea(user=user, title=u'title2')

        self.assertEqual(Idea.ideas_bunch(Idea.idea_id),
                         [idea1, idea2, idea3, idea4])
        self.assertEqual(Idea.ideas_bunch(Idea.idea_id, 2), [idea1, idea2])
        self.assertEqual(Idea.ideas_bunch(Idea.title),
                         [idea1, idea4, idea2, idea3])
Beispiel #4
0
def main_view(request):
    hitpct = Idea.ideas_bunch(Idea.hit_percentage.desc())
    top = Idea.ideas_bunch(Idea.hits.desc())
    bottom = Idea.ideas_bunch(Idea.misses.desc())
    last10 = Idea.ideas_bunch(Idea.idea_id.desc())
    
    toplists = [
        {'title': 'Latest shots', 'items': last10},
        {'title': 'Most hits', 'items': top},
        {'title': 'Most misses', 'items': bottom},
        {'title': 'Best performance', 'items': hitpct},
    ]

    login_form = login_form_view(request)
    
    return {
        'username': authenticated_userid(request),
        'toolbar': toolbar_view(request),
        'cloud': cloud_view(request),
        'latest': latest_view(request),
        'login_form': login_form,
        'toplists': toplists,
    }
Beispiel #5
0
def main_view(request):
    hitpct = Idea.ideas_bunch(Idea.hit_percentage.desc())
    top = Idea.ideas_bunch(Idea.hits.desc())
    bottom = Idea.ideas_bunch(Idea.misses.desc())
    last10 = Idea.ideas_bunch(Idea.idea_id.desc())

    toplists = [
        {"title": "Latest shots", "items": last10},
        {"title": "Most hits", "items": top},
        {"title": "Most misses", "items": bottom},
        {"title": "Best performance", "items": hitpct},
    ]

    login_form = login_form_view(request)

    return {
        "username": authenticated_userid(request),
        "toolbar": toolbar_view(request),
        "cloud": cloud_view(request),
        "latest": latest_view(request),
        "login_form": login_form,
        "toplists": toplists,
    }
Beispiel #6
0
def latest_view(request):
    latest = Idea.ideas_bunch(Idea.idea_id.desc(), with_joinedload=False)
    return render('templates/latest.pt', {'latest': latest}, request)
Beispiel #7
0
def latest_view(request):
    latest = Idea.ideas_bunch(Idea.idea_id.desc())
    return render('templates/latest.pt', {'latest': latest}, request)
Beispiel #8
0
def latest_view(request):
    latest = Idea.ideas_bunch(Idea.idea_id.desc())
    return render('templates/latest.pt', {'latest': latest}, request)
Beispiel #9
0
def latest_view(request):
    latest = Idea.ideas_bunch(Idea.idea_id.desc(), with_joinedload=False)
    return render("templates/latest.pt", {"latest": latest}, request)