コード例 #1
0
def home(request):
    collections = Collection.objects.all().order_by("name")
    raw_extent = Collection.objects.all().aggregate(Sum("extent"))["extent__sum"]
    extent = bytes2human(raw_extent)

    return render_to_response(
        "dl_collections/index.html", {"collections": collections, "extent": extent, "campuses": campuses}
    )
コード例 #2
0
def UC(request, urlstuff):
    campus = get_object_or_404(Campus, slug=urlstuff)
    extent = bytes2human(
        Collection.objects.filter(campus__slug__exact=urlstuff).aggregate(Sum("extent"))["extent__sum"] or 0
    )
    collections = Collection.objects.filter(campus__slug__exact=urlstuff).order_by("name")
    return render_to_response(
        "dl_collections/campus.html",
        {"campus": campus, "collections": collections, "extent": extent, "campuses": campuses},
    )
コード例 #3
0
 def human_extent(self):
     return bytes2human(self.extent)
コード例 #4
0
 def human_extent(self):
     return bytes2human(self.extent, format=u'%(value).1f\xa0%(symbol)s')
コード例 #5
0
 def human_extent(self):
     return bytes2human(self.extent, format=u'%(value).1f\xa0%(symbol)s')
コード例 #6
0
 def human_extent(self):
     return bytes2human(self.extent)