Ejemplo n.º 1
0
def product_manage():
	product_json = read_mongo().get_product()
	len_json = len(product_json)-1

	if request.method == "POST":
		product = request.form["product"]
		product_temp = request.form["product_temp"]
		if product!=product_temp:
			product=product_temp
		name = request.form["name"]
		print name,"===="*10,type(name)
		intro = request.form["intro"]
		id_ = request.form["id"]
		

		pu = {"name":name,"intro":intro,"product":product}
		
		print "!!!",pu,"!!!"
		write_mongo().update_product(pu,id_)


		product_json = read_mongo().get_product()
		en_json = len(product)-1

	return render_template("/dashboard/product_manage.html",json=product_json,len_p=len_json)
Ejemplo n.º 2
0
def index_banner():
	folder = "static/upload/index_banner"
	if os.path.exists(folder)==False:
			os.makedirs(folder)


	if request.method == "GET":
		banner_json = read_mongo().get_index_banner()
		
	elif request.method == "POST":
		file_th = request.form["banner_th"]
		print file_th
		file = request.files["file"]
		
		if file and allowed_file(file.filename):
			# filename = secure_filename(file.filename)
			filename= "banner"+file_th+".jpg"
			file.save(os.path.join(folder, filename))
			banner_json = read_mongo().get_index_banner()
			banner_json[file_th] = filename
			write_mongo().index_banner(banner_json)

		banner_json = read_mongo().get_index_banner()

		
	



	


	return render_template("/dashboard/index_banner.html",banner_json=banner_json)
Ejemplo n.º 3
0
def inner_1():
	menu_json = read_mongo().get_index_menu()
	if request.method == 'GET':
		class_name = request.args.get("class_name")

		if class_name:
			product_list = read_mongo().get_product_list(class_name)
			
			# return product_list
			return render_template("inner_1.html",product_list=product_list,class_name=class_name,menu_json=menu_json)
		else:
			return render_template("index.html")
	else:
		return "400"
Ejemplo n.º 4
0
def login():
	if request.method == 'GET':
		return render_template("/dashboard/login.html")
	elif request.method == 'POST':
		name = request.form["user_name"]
		pass_w = request.form["user_pass"]
		if name=="lamome" and pass_w =="Lamome233":
			sess["user"] = name
			index_menu_json = read_mongo().get_index_menu()
			return render_template("/dashboard/index_menu.html",json=index_menu_json)

		return render_template("/dashboard/login.html",err="err")
Ejemplo n.º 5
0
def index_menu():
	
	if request.method == "GET":
		index_menu_json = read_mongo().get_index_menu()
		return render_template("/dashboard/index_menu.html",json=index_menu_json)
	elif request.method == "POST":
		key_1 = request.form["tag_1"]
		key_2 = request.form["tag_2"]
		key_3 = request.form["tag_3"]
		key_4 = request.form["tag_4"]
		key_5 = request.form["tag_5"]
		key_6 = request.form["tag_6"]
		value_1 = request.form["value_1"]
		value_2 = request.form["value_2"]
		value_3 = request.form["value_3"]
		value_4 = request.form["value_4"]
		value_5 = request.form["value_5"]
		value_6 = request.form["value_6"]
		mongo_json = {key_1:value_1,key_2:value_2,key_3:value_3,key_4:value_4,key_5:value_5,key_6:value_6}
		write_mongo().index_menu(mongo_json)
		index_menu_json = read_mongo().get_index_menu()
		return render_template("/dashboard/index_menu.html",json=index_menu_json)
Ejemplo n.º 6
0
def product_show():
	folder = "static/upload/product_show"
	if os.path.exists(folder)==False:
			os.makedirs(folder)

	if request.method == "GET":
		product_show_json = read_mongo().get_product_show()
	elif request.method == "POST":
		product_name = request.form["product_name"]
		name = request.form["name"]
		index_name = request.form["index"]
		print product_name,name
		
		file = request.files["file"]

		if file and allowed_file(file.filename):
			# filename = secure_filename(file.filename)
			filename = "product_"+index_name+".jpg"
			file.save(os.path.join(folder, filename))

			product_show_json = read_mongo().get_product_show()
			product_show_json.pop(name)

			product_show_json[product_name] = filename
			print product_show_json
			write_mongo().product_show(product_show_json)


		product_show_json = read_mongo().get_product_show()






	return render_template("/dashboard/product_show.html",json=product_show_json)
Ejemplo n.º 7
0
def inner_2():
	product_id = request.args.get("product_id")
	product_intro = read_mongo().get_product_intro(product_id)
	menu_json = read_mongo().get_index_menu()

	return render_template("inner_2.html",product_intro=product_intro,menu_json=menu_json)
Ejemplo n.º 8
0
def index():
	product_show_json = read_mongo().get_product_show()
	menu_json = read_mongo().get_index_menu()
	return render_template("index.html",product_show_json=product_show_json,menu_json=menu_json)
Ejemplo n.º 9
0
def delet_product():
	id_ = request.args["id"]
	write_mongo().delet_product(id_)
	product_json = read_mongo().get_product()
	len_json = len(product_json)-1
	return render_template("/dashboard/product_manage.html",json=product_json,len_p=len_json)