예제 #1
0
def news_PBL(request):
    classes_list=mongodb_options.find_classes(db)
    brands_list=mongodb_options.find_brands(db)
    brands_list_design=[]
    for brand in brands_list:
        if brand["isdesign"]==u"是":
            brands_list_design.append(brand)
    news_list=mongodb_options.find_news(db)
    news_list1=news_list[:15]
    news_list2=news_list[15:]
    json.dumps('news_list2',news_list2)
    flag=False
    if "login_user" in request.session:
        username=request.session['login_user']
        flag=True
    if flag:
        cart=client_mongodb_options.find_cart(db,username)
        if cart:
            c_num=cart['c_num']
        else:
            c_num=0
        return render(request,'client/client_newsPBL.html',{'flag':flag,'c_num':c_num,'username':username,'classes_list':classes_list,'brands_list':brands_list,'brands_list_design': brands_list_design,"news_list2":news_list2,"news_list1":news_list1})
    else:
        return render(request,'client/client_newsPBL.html',{'flag':flag,'classes_list': classes_list,'brands_list': brands_list,'brands_list_design': brands_list_design,'news_list2':news_list2,'news_list1':news_list1})
예제 #2
0
def req_news(request):
    if "username" in request.session:
        username=request.session['username']
    news_list=mongodb_options.find_news(db)
    return render(request,'manage_news.html',{'login_user':username,'flag':True,'news_list':news_list})