Beispiel #1
0
def _get_app(grp):
    app = grp.app
    return {
        "id": app.pk,
        "md5": app.apk.md5,
        "package": app.package,
        "name":  app.name,
        "icon": app.app_icon,
        "desc": app.desc,
        "version": app.version,
        "size": bitsize(app.size()),
        "bits": app.size(),
        "apk": app.apk.file
    }
Beispiel #2
0
def subjects(request):
    subjects = Subject.objects.filter(online=True).order_by('position')
    now = datetime.datetime.now()
    ads = AD.objects.filter(visible=True).filter(from_date__lt=now).filter(to_date__gt=now).order_by('position')
    results = []
    for item in subjects:
        grps = AppGroup.objects.filter(subject=item).filter(app__online=True)
        if  grps.count() != 0:
            results.append({
                "id": item.pk,
                "name": item.name,
                "cover": item.cover,
                "desc": item.desc,
                "count": grps.count(),
                "size": bitsize(get_subject_total_size(item)),
            })        
    
    return render(request, "wandoujia/subjects.html", {"subjects": results, "ads": ads})