def ilove(request): ip_address = ip_address_handler.get_client_ip(request) ip_address_handler.save_access_information(ip_address) #login = request.session.get('login',None) is_login = "******" for cookie in cookieJar: if cookie.name == "is_login" and cookie.value == "true": is_login = "******" #if login is None: #is_login = "******" #else: #is_login = login ''' This is a segment of magic codes, please do relife it, or, it will let you down :( ''' #ip_address_handler.update() request.session['ip'] = ip_address customer = get_customer(request) conf = { 'customer':customer, 'is_login':is_login, } return render(request, 'shopping_home/start.html', conf)
def mytest_index(request): ip_address = ip_address_handler.get_client_ip(request) ip_address_handler.save_access_information(ip_address) request.session['ip'] = ip_address goods_getter = GoodsGetter() designers_getter = DesignersGetter() recommend_num = 3 designer_num = 3 index_goods_list = goods_getter.get_recommend_goods(recommend_num) index_designers_list = designers_getter.get_recommend_designers( designer_num) customer = None if request.user.is_authenticated(): try: customer = Customer.objects.get(user_id=request.user.id) except ObjectDoesNotExist: customer = None conf = {'goods_list': index_goods_list, 'all_designer': index_designers_list, 'customer': customer, 'goods_server_path': adminer_website.goods_server_path, } return render(request, website.v1_1_index, conf)