예제 #1
0
파일: utils.py 프로젝트: rodo/pyrede
    def test_stats(self):
        """
        stats return a dict
        """
        cache.set("stats_nb_pack", 1)
        cache.set("stats_nb_packversion", 2)
        cache.set("stats_nb_dispack", 3)

        result = stats()

        attend = {'stats_nb_pack': 1,
                  'stats_nb_packbersion': 2,
                  'dispack': 3}

        self.assertEqual(result, attend)
예제 #2
0
파일: views.py 프로젝트: rodo/pyrede
def userreq(request):
    """
    Main page containing the form to lookup used on homepage
    """
    queryset = Package.objects.all().order_by('-pk')[:7]
    lkups = Lookup.objects.all().order_by('-pk')[:4]
    distributions = Distribution.objects.filter(official=None).order_by('-pk')
    dists = [(r.id, "%s %s" % (r.name, r.version_name)) for r in distributions]
    form = ReqForm(dists)

    return render(request,
                  'form.html',
                  {'form': form,
                   'packages': queryset,
                   'lookups': lkups,
                   'stats': stats()
                   })