Ejemplo n.º 1
0
def get_account_loglist_context(id, is_actor):
    from itertools import chain
    from django.db.models import Q
    from operator import attrgetter
    l = None
    if is_actor == 'true':
        accountLog = LogAccount.objects.filter(user_id=id)
        brwLog = LogBorrow.objects.filter(user_id=id)
        compLog = LogComputing.objects.filter(user_id=id)
        goodLog = LogSingle.objects.filter(user_id=id)
        l = sorted(chain(accountLog, brwLog, compLog, goodLog),
                   key=attrgetter('time'),
                   reverse=False)
    elif is_actor == 'false':
        l = LogAccount.objects.filter(target__user__id=id).order_by('time')
    else:
        accountLog = LogAccount.objects.filter(
            Q(user_id=id) | Q(target__user__id=id))
        brwLog = LogBorrow.objects.filter(user_id=id)
        compLog = LogComputing.objects.filter(user_id=id)
        goodLog = LogSingle.objects.filter(user_id=id)
        l = sorted(chain(accountLog, brwLog, compLog, goodLog),
                   key=attrgetter('time'),
                   reverse=False)
    return get_context_list(l, get_context_log)
Ejemplo n.º 2
0
def get_account_loglist_context(id, is_actor):
    from itertools import chain
    from django.db.models import Q
    from operator import attrgetter
    l = None
    if is_actor == 'true':
        accountLog = LogAccount.objects.filter(user_id=id)
        brwLog = LogBorrow.objects.filter(user_id=id)
        compLog = LogComputing.objects.filter(user_id=id)
        goodLog = LogSingle.objects.filter(user_id=id)
        l = sorted(
            chain(
                accountLog,
                brwLog,
                compLog,
                goodLog),
            key=attrgetter('time'),
            reverse=False)
    elif is_actor == 'false':
        l = LogAccount.objects.filter(target__user__id=id).order_by('time')
    else:
        accountLog = LogAccount.objects.filter(
            Q(user_id=id) | Q(target__user__id=id))
        brwLog = LogBorrow.objects.filter(user_id=id)
        compLog = LogComputing.objects.filter(user_id=id)
        goodLog = LogSingle.objects.filter(user_id=id)
        l = sorted(
            chain(
                accountLog,
                brwLog,
                compLog,
                goodLog),
            key=attrgetter('time'),
            reverse=False)
    return get_context_list(l, get_context_log)
Ejemplo n.º 3
0
def get_goods_loglist_context(id, is_actor):
    l = LogSingle.objects.filter(target__id=id).order_by('time')
    return get_context_list(l, get_context_log)
Ejemplo n.º 4
0
def get_computing_loglist_context(id, is_actor):
    l = LogComputing.objects.filter(target__id=id).order_by('time')
    return get_context_list(l, get_context_log)
Ejemplo n.º 5
0
def get_borrow_loglist_context(id, is_actor):
    l = LogBorrow.objects.filter(target__id=id).order_by('time')
    return get_context_list(l, get_context_log)
Ejemplo n.º 6
0
def get_goods_loglist_context(id, is_actor):
    l = LogSingle.objects.filter(target__id=id).order_by('time')
    return get_context_list(l, get_context_log)
Ejemplo n.º 7
0
def get_computing_loglist_context(id, is_actor):
    l = LogComputing.objects.filter(target__id=id).order_by('time')
    return get_context_list(l, get_context_log)
Ejemplo n.º 8
0
def get_borrow_loglist_context(id, is_actor):
    l = LogBorrow.objects.filter(target__id=id).order_by('time')
    return get_context_list(l, get_context_log)