コード例 #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)
コード例 #2
0
ファイル: views.py プロジェクト: jiguanglizipao/LSMS
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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #6
0
ファイル: views.py プロジェクト: jiguanglizipao/LSMS
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)
コード例 #7
0
ファイル: views.py プロジェクト: jiguanglizipao/LSMS
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)
コード例 #8
0
ファイル: views.py プロジェクト: jiguanglizipao/LSMS
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)