当前位置: 首页>>代码示例>>Python>>正文


Python Gift.accept_filters方法代码示例

本文整理汇总了Python中apps.gift.models.Gift.accept_filters方法的典型用法代码示例。如果您正苦于以下问题:Python Gift.accept_filters方法的具体用法?Python Gift.accept_filters怎么用?Python Gift.accept_filters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apps.gift.models.Gift的用法示例。


在下文中一共展示了Gift.accept_filters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_counts

# 需要导入模块: from apps.gift.models import Gift [as 别名]
# 或者: from apps.gift.models.Gift import accept_filters [as 别名]
def get_counts(request):
    counts = memcache.get('api_get_count')
    if not counts:
        coming_soon = Gift.accept_filters(filters=['coming_soon']).count()
        on_sale = Gift.accept_filters(filters=['on_sale']).count()
        no_sale = Gift.accept_filters(filters=['no_sale']).count()
        total = coming_soon + on_sale + no_sale
        if total:
            counts = {
                'coming_soon': coming_soon,
                'on_sale': on_sale,
                'no_sale': no_sale,
                'total': total}
        if counts:
            memcache.set('api_get_count', counts, 7200)
    return render_json_response(counts)
开发者ID:gmist,项目名称:five-studio,代码行数:18,代码来源:views.py

示例2: get_coming_soon_list

# 需要导入模块: from apps.gift.models import Gift [as 别名]
# 或者: from apps.gift.models.Gift import accept_filters [as 别名]
def get_coming_soon_list(request):
    list_gifts = memcache.get('api_get_coming_soon_list')
    if not list_gifts:
        gifts = Gift.accept_filters(filters=['coming_soon'])
        if gifts:
            list_gifts = [gift.uid for gift in gifts]
            memcache.add('api_get_coming_soon_list', list_gifts, 7200)
    return render_json_response(list_gifts)
开发者ID:gmist,项目名称:five-studio,代码行数:10,代码来源:views.py

示例3: internal_delete_gifts_json_1c

# 需要导入模块: from apps.gift.models import Gift [as 别名]
# 或者: from apps.gift.models.Gift import accept_filters [as 别名]
def internal_delete_gifts_json_1c(request, task_id):
    id_1c = memcache.get(task_id)
    memcache.delete(task_id)
    if id_1c:
        gifts_obj = Gift.accept_filters().filter('id_1c =', id_1c)
        if gifts_obj.count():
            gift = gifts_obj[0]
            gift.delete()
    return render_to_response('empty.html')
开发者ID:gmist,项目名称:five-studio,代码行数:11,代码来源:views.py

示例4: internal_delete_gifts_json

# 需要导入模块: from apps.gift.models import Gift [as 别名]
# 或者: from apps.gift.models.Gift import accept_filters [as 别名]
def internal_delete_gifts_json(request, task_id):
    name = memcache.get(task_id)
    memcache.delete(task_id)
    if name:
        gifts_obj = Gift.accept_filters().filter('name =', name)
        if gifts_obj.count():
            gift = gifts_obj[0]
            gift.delete()
    return render_to_response('empty.html')
开发者ID:gmist,项目名称:five-studio,代码行数:11,代码来源:views.py

示例5: sitemap

# 需要导入模块: from apps.gift.models import Gift [as 别名]
# 或者: from apps.gift.models.Gift import accept_filters [as 别名]
def sitemap(request):
    gift_urls = memcache.get(SITEMAP_MEMCACHE_NAME)
    if not gift_urls:
        gifts = Gift.accept_filters()
        gift_urls = [
        {'uid': g.uid,
        'lastmod': '%s' \
        % (g.modif_time.date())}\
        for g in gifts]
        memcache.add(SITEMAP_MEMCACHE_NAME, gift_urls, SITEMAP_MEMCACHE_LIVE)
    return render_to_response('sitemaps/sitemap.xml', {'gift_urls': gift_urls})
开发者ID:gmist,项目名称:five-studio,代码行数:13,代码来源:views.py

示例6: get_changed_gifts_from_date

# 需要导入模块: from apps.gift.models import Gift [as 别名]
# 或者: from apps.gift.models.Gift import accept_filters [as 别名]
def get_changed_gifts_from_date(request):
    date = request.values.get('from_date', None)
    if date is None:
        return redirect('/api/')
    try:
        date_t = datetime.strptime(date, '%Y-%m-%d')
    except ValueError:
        return redirect('/api/')
    memcache_name = 'api_get_changed_gifts_from_date_%s' % date
    list_gifts = memcache.get(memcache_name)
    if not list_gifts:
        gifts = Gift.accept_filters().filter('modif_time >', date_t)
        if gifts:
            list_gifts = [gift.uid for gift in gifts]
            memcache.add(memcache_name, list_gifts, 7200)
    return render_json_response(list_gifts)
开发者ID:gmist,项目名称:five-studio,代码行数:18,代码来源:views.py

示例7: get_new_gifts_between_dates

# 需要导入模块: from apps.gift.models import Gift [as 别名]
# 或者: from apps.gift.models.Gift import accept_filters [as 别名]
def get_new_gifts_between_dates(request):
    date1 = request.values.get("from_date", None)
    date2 = request.values.get('to_date', None)
    if date1 is None or date2 is None:
        return redirect('/api/')
    try:
        date_t1 = datetime.strptime(date1, '%Y-%m-%d')
        date_t2 = datetime.strptime(date2, '%Y-%m-%d')
    except ValueError:
        return redirect('/api/')
    memcache_name = 'api_get_new_gifts_between_dates_%s_%s' % (date1, date2)
    list_gifts = memcache.get(memcache_name)
    if not list_gifts:
        gifts = Gift.accept_filters().filter('add_time >=', date_t1)\
            .filter('add_time <=', date_t2)
        if gifts:
            list_gifts = [gift.uid for gift in gifts]
            memcache.add(memcache_name, list, 7200)
    return render_json_response(list_gifts)
开发者ID:gmist,项目名称:five-studio,代码行数:21,代码来源:views.py


注:本文中的apps.gift.models.Gift.accept_filters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。