Exemple #1
0
def tag_list():
    meta = metaInit.copy()
    query = {}
    page = int(request.args.get('page', 1))
    per_page = 20
    status = int(request.args.get('status', 0))
    deleted = int(request.args.get('deleted', 0))
    page_url = url_for('admin.tag_list', page="#p#", status=status)
    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    elif status == 1:
        query['status'] = 1
        meta['css_verify'] = 'active'
    elif status == 5:
        query['status'] = 5
        meta['css_success'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted
    current_app.logger.debug(type(g.user))

    data = Tag.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = Tag.objects(**query).count()

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/tag/list.html', meta=meta)
Exemple #2
0
def category_list():
    meta = {
        'title': '分类管理',
        'css_nav_sub_category': 'active',
        'css_nav_system': 'active'
    }
    query = {}
    page = int(request.args.get('page', 1))
    per_page = int(request.args.get('per_page', 100))
    status = int(request.args.get('status', 0))
    kind = int(request.args.get('kind', 0))
    deleted = int(request.args.get('deleted', 0))
    if kind:
        query['kind'] = kind
        if kind == 1:
            meta['css_doc'] = 'active'
        elif kind == 2:
            meta['css_other'] = 'active'
        else:
            meta['css_all'] = 'active'
    else:
        meta['css_all'] = 'active'

    if status == -1:
        query['status'] = 0
    elif status == 1:
        query['status'] = 1
    else:
        pass

    query['deleted'] = deleted

    page_url = url_for('admin.category_list',
                       page="#p#",
                       status=status,
                       kind=kind,
                       per_page=per_page)
    data = Category.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = Category.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        kind_label = '--'
        if d.kind == 1:
            kind_label = '文档'
        if d.kind == 2:
            kind_label = '备用'

        data.items[i].kind_label = kind_label

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/category/list.html', meta=meta)
Exemple #3
0
def growth_list():
    meta = {
        'title': '增长值记录',
        'css_nav_sub_growth': 'active',
        'css_nav_reptile': 'active'
    }
    query = {}
    page = int(request.args.get('page', 1))
    per_page = 20
    status = int(request.args.get('status', 0))
    deleted = int(request.args.get('deleted', 0))
    target_id = request.args.get('target_id', '')
    day = request.args.get('day', '')
    if day:
        query['day'] = int(day)
        meta['day'] = day
    if target_id:
        query['target_id'] = int(target_id)
        meta['target_id'] = target_id
    page_url = url_for('admin.growth_list', page="#p#", status=status)
    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted

    data = GrowthRecord.objects(**query).order_by('-created_at').paginate(page=page, per_page=per_page)
    total_count = GrowthRecord.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        if d.site_from == 0:
            data.items[i].site_from_label
            data.items[i].site_type_label
        else:
            label = platform_options(d.site_from)
            data.items[i].site_from_label = label['name']
        if d.target_id:
            product = Product.objects(_id=d.target_id).first()
            if product:
                data.items[i].product = product
            else:
                data.items[i].product = {}

            data.items[i].site_type_label = platform_type(d.site_type)

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/growth/list.html', meta=meta)
Exemple #4
0
def brand_list():
    meta = metaInit.copy()
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 0))

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t==1:
            query['_id'] = force_int(q)
        if t==2:
            query['name'] = {"$regex": q.strip()}

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        pass

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
    else:
        query['deleted'] = 0

    if not status and not deleted:
        meta['css_all'] = 'active'
    else:
        meta['css_all'] = ''

    page_url = url_for('admin.brand_list', page="#p#", q=q, t=t, kind=kind, status=status)

    data = Brand.objects(**query).order_by('-created_at').paginate(page=page, per_page=per_page)
    total_count = Brand.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        data.items[i].cover = d.cover()
        data.items[i].user = d.user()

    meta['data'] = data.items
    meta['total_count'] = total_count

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/brand/list.html', meta=meta)
Exemple #5
0
def design_conf_list():
    meta = {
        'title': '设计公司配置管理',
        'css_nav_sub_design_conf': 'active',
        'css_nav_design': 'active'
    }
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['mark'] = q.strip()
        if t == 2:
            query['name'] = {"$regex": q.strip()}

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted

    page_url = url_for('admin.design_conf_list',
                       page="#p#",
                       q=q,
                       t=t,
                       status=status)

    data = DesignConf.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = DesignConf.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        pass

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/design_conf/list.html', meta=meta)
Exemple #6
0
def article_list():
    meta = {
        'title': '文章管理',
        'css_nav_sub_article': 'active',
        'css_nav_article': 'active'
    }
    query = {}
    page = int(request.args.get('page', 1))
    per_page = 100
    status = int(request.args.get('status', 0))
    deleted = int(request.args.get('deleted', 0))
    page_url = url_for('admin.product_list', page="#p#", status=status)
    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    elif status == 1:
        query['status'] = 1
        meta['css_verify'] = 'active'
    elif status == 5:
        query['status'] = 5
        meta['css_success'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted

    data = Product.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = Product.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        if d.site_from == 0:
            data.items[i].site_from_label
            data.items[i].site_type_label
        else:
            label = platform_options(d.site_from)
            data.items[i].site_from_label = label['name']

        data.items[i].site_type_label = platform_type(d.site_type)
        data.items[i].category_tags_s = ','.join(d.category_tags)
        data.items[i].tags_s = ','.join(d.tags)

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/article/list.html', meta=meta)
Exemple #7
0
def user_list():
    meta = {
        'title': '用户管理',
        'css_nav_sub_user': '******',
        'css_nav_system': 'active'
    }

    query = {}
    page = int(request.args.get('page', 1))
    per_page = int(request.args.get('per_page', 100))
    status = int(request.args.get('status', 0))

    t = int(request.args.get('t', 1))
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['_id'] = force_int(q.strip(), 0)
        if t == 2:
            query['account'] = {"$regex": q.strip()}
        if t == 3:
            query['phone'] = q.strip()
        if t == 4:
            query['email'] = q.strip()

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    elif status == 1:
        query['status'] = 1
        meta['css_verify'] = 'active'
    elif status == 5:
        query['status'] = 5
        meta['css_success'] = 'active'
    else:
        meta['css_all'] = 'active'

    page_url = url_for('admin.user_list', page="#p#", q=q, t=t, status=status)
    data = User.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = User.objects(**query).count()
    meta['data'] = data.items
    meta['total_count'] = total_count
    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/user/list.html', meta=meta)
Exemple #8
0
def site_list():
    meta = metaInit.copy()
    query = {}
    page = int(request.args.get('page', 1))
    per_page = int(request.args.get('per_page', 20))
    status = int(request.args.get('status', 0))
    deleted = int(request.args.get('deleted', 0))
    page_url = url_for('admin.site_list', page="#p#", status=status)
    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        meta['css_all'] = 'active'

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
        meta['css_all'] = ''
    else:
        query['deleted'] = 0

    data = Site.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = Site.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        if d.site_from == 0:
            data.items[i].site_from_label = platform_options()
        else:
            label = platform_options(d.site_from)
            data.items[i].site_from_label = label['name']

        data.items[i].site_type_label = platform_type(d.site_type)

    meta['data'] = data.items
    meta['total_count'] = total_count
    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/site/list.html', meta=meta)
Exemple #9
0
def company_queue_list():
    meta = {
        'title': '待执行队列',
        'css_nav_sub_company_queue': 'active',
        'css_nav_design': 'active',
        'css_all': 'active'
    }
    query = {}
    page = int(request.args.get('page', 1))
    per_page = 20
    status = int(request.args.get('status', 0))
    deleted = int(request.args.get('deleted', 0))
    page_url = url_for('admin.company_queue_list', page="#p#", status=status)
    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    elif status == 1:
        query['status'] = 1
        meta['css_verify'] = 'active'
    elif status == 5:
        query['status'] = 5
        meta['css_success'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted
    current_app.logger.debug(type(g.user))

    data = CompanyQueue.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = CompanyQueue.objects(**query).count()

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/company_queue/list.html', meta=meta)
Exemple #10
0
def order_list():
    meta = {
        'title': '订单管理',
        'css_nav_sub_order': 'active',
        'css_nav_reptile': 'active'
    }
    query = {}
    page = int(request.args.get('page', 1))
    per_page = 20
    status = int(request.args.get('status', 0))
    deleted = int(request.args.get('deleted', 0))
    page_url = url_for('admin.order_list', page="#p#", status=status)
    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    elif status == 1:
        query['status'] = 1
        meta['css_verify'] = 'active'
    elif status == 5:
        query['status'] = 5
        meta['css_success'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted

    data = Order.objects(**query).order_by('create_at').paginate(
        page=page, per_page=per_page)
    total_count = Order.objects(**query).count()

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/order/list.html', meta=meta)
Exemple #11
0
def design_case_list():
    meta = {
        'title': '设计作品管理',
        'css_nav_sub_design_case': 'active',
        'css_nav_design': 'active'
    }
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))
    prize_label = request.args.get('prize_label', '')
    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            try:
                query['_id'] = ObjectId(q.strip())
            except (Exception) as e:
                query['_id'] = ''
        if t == 2:
            query['title'] = {"$regex": q.strip()}
        if t == 3:
            query['target_id'] = q.strip()

    if prize_label:
        query['prize_label'] = prize_label

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted

    page_url = url_for('admin.design_case_list',
                       page="#p#",
                       q=q,
                       t=t,
                       prize_label=prize_label,
                       status=status)

    data = DesignCase.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = DesignCase.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        pass

    meta['data'] = data.items
    meta['total_count'] = total_count

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/design_case/list.html', meta=meta)
Exemple #12
0
def produce_list():
    meta = metaInit.copy()
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 0))
    prize_id = force_int(request.args.get('prize_id', 0))
    editor_level = force_int(request.args.get('editor_level', 0))
    site_mark = request.args.get('site_mark', '')

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['_id'] = ObjectId(q.strip())
        if t == 2:
            query['channel'] = q.strip()
        if t == 3:
            query['evt'] = force_int(q.strip())

    if prize_id:
        query['prize'] = {'$elemMatch': {'id': int(prize_id)}}

    if kind:
        if kind == 1:
            meta['css_design'] = 'active'
        elif kind == 5:
            meta['css_fashion'] = 'active'
        meta['css_all'] = ''
        query['kind'] = kind

    if editor_level:
        if editor_level == -1:
            query['editor_level'] = 0
        else:
            query['editor_level'] = editor_level

    if status == -1:
        query['status'] = 0
    if status == 1:
        query['status'] = 1
    else:
        pass

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
    else:
        query['deleted'] = 0
    if site_mark:
        query['channel'] = site_mark
    if not kind and not deleted:
        meta['css_all'] = 'active'
    else:
        meta['css_all'] = ''

    page_url = url_for('admin.produce_list', page="#p#", q=q, t=t, prize_id=prize_id, site_mark=site_mark, editor_level=editor_level, kind=kind,
                       status=status, deleted=deleted)

    data = Produce.objects(**query).order_by('-created_at').paginate(page=page, per_page=per_page)
    total_count = Produce.objects(**query).count()
    site_list = Site.objects(kind=1, status=1, deleted=0)
    # 过滤数据
    rows = t_admin_produce_list(data)
    meta['data'] = rows
    meta['total_count'] = total_count
    meta['prize_options'] = prize_options()
    meta['site_list'] = site_list
    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/produce/list.html', meta=meta)
def design_record_list():
    meta = {
        'title': '设计公司统计管理',
        'css_nav_sub_design_record': 'active',
        'css_nav_design': 'active'
    }
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))
    sort = force_int(request.args.get('sort', 0))
    is_d3in = force_int(request.args.get('is_d3in', 0))
    mark = request.args.get('mark', '')
    number = request.args.get('number', '')
    no = request.args.get('no', '')

    if mark:
        query['mark'] = mark
    if no:
        query['no'] = no
    if number:
        query['number'] = number

    if is_d3in:
        if is_d3in == -1:
            query['is_d3in'] = 0
        elif is_d3in == 1:
            query['is_d3in'] = 1

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        meta['css_all'] = 'active'

    query['deleted'] = deleted

    # 排序
    sortVal = '-created_at'
    nSortVal = '-base_average'
    if sort:
        if sort == 1:
            sortVal = '-ave_score'
        elif sort == 2:
            sortVal = '-base_average'
        elif sort == 3:
            sortVal = '-business_average'
        elif sort == 4:
            sortVal = '-innovate_average'
        elif sort == 5:
            sortVal = '-design_average'
        elif sort == 6:
            sortVal = '-effect_average'
        elif sort == 7:
            sortVal = '-credit_average'

    if sortVal == nSortVal:
        nSortVal = '-base_average'

    page_url = url_for('admin.design_record_list',
                       page="#p#",
                       mark=mark,
                       no=no,
                       number=number,
                       sort=sort,
                       is_d3in=is_d3in,
                       status=status)

    data = DesignRecord.objects(**query).order_by(sortVal, nSortVal).paginate(
        page=page, per_page=per_page)
    total_count = DesignRecord.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        data.items[i].design_company = {}
        designCompany = DesignCompany.objects(number=int(d.number)).fields(
            ['_id', 'name', 'logo_url', 'd3ing_id']).first()
        if designCompany:
            data.items[i].design_company = designCompany

    meta['data'] = data.items

    # 获取配置列表
    confArr = DesignConf.objects(status=1).fields(['mark', 'name'])
    meta['design_conf'] = confArr

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()
    meta['total_count'] = total_count
    meta['design_dimension_options'] = design_dimension_options()
    meta['design_fields_label_options'] = design_fields_label_options()
    #current_app.logger.debug('aaaa')

    return render_template('admin/design_record/list.html', meta=meta)
Exemple #14
0
def column_list():
    meta = metaInit.copy()
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 0))
    column_zone_id = request.args.get('column_zone_id', 0)
    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['_id'] = ObjectId(q.strip())
        if t == 2:
            query['title'] = q.strip()

    if column_zone_id:
        query['column_zone_id'] = column_zone_id

    if kind:
        if kind == 1:
            meta['css_industry'] = 'active'
        elif kind == 2:
            meta['css_plane'] = 'active'
        meta['css_all'] = ''
        query['kind'] = kind

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        pass

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
    else:
        query['deleted'] = 0

    if not status and not deleted:
        meta['css_all'] = 'active'
    else:
        meta['css_all'] = ''

    page_url = url_for('admin.column_list', page="#p#", q=q, t=t, kind=kind, status=status,
                       deleted=deleted)
    data = Column.objects(**query).order_by('-created_at').paginate(page=page, per_page=per_page)

    total_count = Column.objects(**query).count()

    for i, d in enumerate(data.items):
        data.items[i].cover = d.cover()
        zone = ''
        if d.column_zone_id:
            zone = ColumnZone.objects(_id=ObjectId(d.column_zone_id)).first()
        data.items[i].zone = zone
    column_zones = ColumnZone.objects.all()
    for i in column_zones:
        i.id = str(i._id)

    meta['data'] = data.items
    meta['total_count'] = total_count
    meta['column_zone_options'] = column_zones

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/column/list.html', meta=meta)
Exemple #15
0
def produce_list():
    meta = metaInit.copy()
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 20))
    status = force_int(request.args.get('status', 1))
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 1))
    prize_id = force_int(request.args.get('prize_id', 0))
    category_id = force_int(request.args.get('category_id', 0))
    tag = request.args.get('tag', '')

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['title'] = {"$regex": q.strip()}
        if t == 2:
            query['channel'] = q.strip()
        if t == 3:
            query['evt'] = force_int(q.strip())

    if prize_id:
        query['prize'] = {'$elemMatch': {'id': int(prize_id)}}

    if category_id:
        query['category_id'] = category_id

    if tag:
        query['total_tags'] = tag

    if kind:
        if kind == 1:
            meta['css_industry'] = 'active'
        elif kind == 2:
            meta['css_plane'] = 'active'
        meta['css_all'] = ''
        query['kind'] = kind

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        pass

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
    else:
        query['deleted'] = 0

    if not status and not deleted:
        meta['css_all'] = 'active'
    else:
        meta['css_all'] = ''

    page_url = url_for('main.produce_list', page="#p#", q=q, t=t, tag=tag, prize_id=prize_id, category_id=category_id, kind=kind, status=status,
                       deleted=deleted)

    data = Produce.objects(**query).order_by('-edit_on', '-editor_level').paginate(page=page, per_page=per_page)
    total_count = Produce.objects(**query).count()

    # 过滤数据
    rows = t_produce_list(data)

    meta['data'] = rows
    meta['total_count'] = total_count
    meta['prize_options'] = prize_options()

    categories = Category.objects(kind=2, status=1, deleted=0)[:30]
    meta['categories'] = categories

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()
    return render_template('produce/list.html', meta=meta)
Exemple #16
0
def design_company_list():
    meta = {
        'title': '设计公司管理',
        'css_nav_sub_design_company': 'active',
        'css_nav_design': 'active',
        'css_all': 'active'
    }
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    craw_user_id = force_int(request.args.get('craw_user_id'), 0)
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 0))

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['number'] = force_int(q.strip())
        if t == 2:
            query['name'] = {"$regex": q.strip()}

    if craw_user_id:
        if craw_user_id == -1:
            query['craw_user_id'] = 0
        else:
            query['craw_user_id'] = craw_user_id

    if kind:
        if kind == 1:
            meta['css_industry'] = 'active'
        elif kind == 2:
            meta['css_plane'] = 'active'
        meta['css_all'] = ''
        query['kind'] = kind

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        pass

    query['deleted'] = deleted

    page_url = url_for('admin.design_company_list',
                       page="#p#",
                       q=q,
                       t=t,
                       kind=kind,
                       status=status,
                       craw_user_id=craw_user_id)

    data = DesignCompany.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = DesignCompany.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        if data.items[i].kind == 1:
            kind_label = '工业设计'
        elif data.items[i].kind == 2:
            kind_label = '平台设计'
        else:
            kind_label = '--'
        data.items[i].kind_label = kind_label

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/design_company/list.html', meta=meta)
Exemple #17
0
def image_list():
    meta = metaInit.copy()
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 20))
    status = force_int(request.args.get('status', 1))
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 1))
    prize_id = force_int(request.args.get('prize_id', 0))
    tag = request.args.get('tag', '')

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['_id'] = ObjectId(q.strip())
        if t == 2:
            query['channel'] = q.strip()
        if t == 3:
            query['evt'] = force_int(q.strip())

    if tag:
        query['total_tags'] = tag

    if prize_id:
        query['prize_id'] = prize_id

    if kind:
        if kind == 1:
            meta['css_industry'] = 'active'
        elif kind == 2:
            meta['css_plane'] = 'active'
        meta['css_all'] = ''
        query['kind'] = kind

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        pass

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
    else:
        query['deleted'] = 0

    if not status and not deleted:
        meta['css_all'] = 'active'
    else:
        meta['css_all'] = ''

    page_url = url_for('main.image_list',
                       page="#p#",
                       q=q,
                       t=t,
                       tag=tag,
                       prize_id=prize_id,
                       kind=kind,
                       status=status,
                       deleted=deleted)

    data = Image.objects(**query).order_by('random').paginate(
        page=page, per_page=per_page)
    total_count = Image.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        prize_label = ''
        brand = None
        data.items[i]._id = str(d._id)
        data.items[i].thumb = d.get_thumb_path()
        if d.prize_id:
            prize_label = prize_options(d.prize_id)['name']
        if d.brand_id:
            brand = Brand.objects(_id=d.brand_id).first()

        data.items[i].prize_label = prize_label
        data.items[i].brand = brand

    # 过滤数据
    rows = t_image_list(data)

    meta['data'] = rows
    meta['total_count'] = total_count
    meta['prize_options'] = prize_options()

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()
    return render_template('image/list.html', meta=meta)
Exemple #18
0
def image_list():
    meta = metaInit.copy()
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 0))

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['id'] = force_int(q.strip())
        if t == 2:
            query['name'] = {"$regex": q.strip()}

    if kind:
        if kind == 1:
            meta['css_industry'] = 'active'
        elif kind == 2:
            meta['css_plane'] = 'active'
        meta['css_all'] = ''
        query['kind'] = kind

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        pass

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
    else:
        query['deleted'] = 0

    if not status and not deleted:
        meta['css_all'] = 'active'
    else:
        meta['css_all'] = ''

    page_url = url_for('admin.image_list',
                       page="#p#",
                       q=q,
                       t=t,
                       kind=kind,
                       status=status,
                       deleted=deleted)

    data = Image.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)
    total_count = Image.objects(**query).count()

    # 过滤数据
    for i, d in enumerate(data.items):
        data.items[i]._id = str(d._id)
        data.items[i].thumb = d.get_thumb_path()
        if d.tags:
            data.items[i].tags_s = ','.join(d.tags)

    meta['data'] = data.items

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/image/list.html', meta=meta)
Exemple #19
0
def column_zone_list():
    meta = metaInit.copy()
    query = {}
    page = force_int(request.args.get('page', 1))
    per_page = force_int(request.args.get('per_page', 100))
    status = force_int(request.args.get('status', 0))
    deleted = force_int(request.args.get('deleted', 0))
    kind = force_int(request.args.get('kind', 0))

    t = force_int(request.args.get('t', 1), 1)
    q = request.args.get('q', '')

    if q:
        if t == 1:
            query['_id'] = ObjectId(q.strip())
        if t == 2:
            query['title'] = q.strip()
        if t == 3:
            query['column_zone_id'] = force_int(q.strip())
    if kind:
        if kind == 1:
            meta['css_industry'] = 'active'
        elif kind == 2:
            meta['css_plane'] = 'active'
        meta['css_all'] = ''
        query['kind'] = kind

    if status == -1:
        meta['css_disable'] = 'active'
        query['status'] = 0
    if status == 1:
        query['status'] = 1
        meta['css_enable'] = 'active'
    else:
        pass

    if deleted == 1:
        query['deleted'] = 1
        meta['css_deleted'] = 'active'
    else:
        query['deleted'] = 0

    if not status and not deleted:
        meta['css_all'] = 'active'
    else:
        meta['css_all'] = ''

    page_url = url_for('admin.column_zone_list',
                       page="#p#",
                       q=q,
                       t=t,
                       kind=kind,
                       status=status,
                       deleted=deleted)
    data = ColumnZone.objects(**query).order_by('-created_at').paginate(
        page=page, per_page=per_page)

    total_count = ColumnZone.objects(**query).count()

    meta['data'] = data.items
    meta['total_count'] = total_count

    pager = Pager(page, per_page, total_count, page_url)
    meta['pager'] = pager.render_view()

    return render_template('admin/column_zone/list.html', meta=meta)