cat list
This commit is contained in:
@@ -946,6 +946,7 @@ def addProvisionAction(member_id,product_uid,action):
|
|||||||
@app.route("/panel/contacts")
|
@app.route("/panel/contacts")
|
||||||
@token_required
|
@token_required
|
||||||
def site_contacts(current_user):
|
def site_contacts(current_user):
|
||||||
|
cat_list = ['A000002','A000004','A000001','A000003']
|
||||||
SUPPORTED_CATEGORY = "SELECT name AS title,product_id from products WHERE product_id IN ('A000002','A000004','A000001','A000003')"
|
SUPPORTED_CATEGORY = "SELECT name AS title,product_id from products WHERE product_id IN ('A000002','A000004','A000001','A000003')"
|
||||||
with connection:
|
with connection:
|
||||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||||
@@ -955,6 +956,7 @@ def site_contacts(current_user):
|
|||||||
print(select_Res)
|
print(select_Res)
|
||||||
contacts_category = json.dumps( [dict(ix) for ix in select_Res] )
|
contacts_category = json.dumps( [dict(ix) for ix in select_Res] )
|
||||||
print(contacts_category)
|
print(contacts_category)
|
||||||
|
array_cat = json.loads(contacts_category)
|
||||||
|
|
||||||
dList = []
|
dList = []
|
||||||
sample_range = random.randint(20, 60)
|
sample_range = random.randint(20, 60)
|
||||||
@@ -963,6 +965,7 @@ def site_contacts(current_user):
|
|||||||
new_l = {
|
new_l = {
|
||||||
"uid":"425611f2-c692-4404-b93d-76ca7a5ce7"+str(x),
|
"uid":"425611f2-c692-4404-b93d-76ca7a5ce7"+str(x),
|
||||||
"title": "Calendar Random Item on " + str(x) ,
|
"title": "Calendar Random Item on " + str(x) ,
|
||||||
|
"category" : cat_list[ random.randint(0, 3) ],
|
||||||
"added": calDate,
|
"added": calDate,
|
||||||
"sender": "Firstname Lastname" + str(random.randint(1, 4)),
|
"sender": "Firstname Lastname" + str(random.randint(1, 4)),
|
||||||
"message" : dummy_message()
|
"message" : dummy_message()
|
||||||
@@ -971,7 +974,7 @@ def site_contacts(current_user):
|
|||||||
|
|
||||||
calendar_data = {
|
calendar_data = {
|
||||||
"last_update": datetime.datetime.utcnow(),
|
"last_update": datetime.datetime.utcnow(),
|
||||||
"category" : contacts_category,
|
"category" : array_cat,
|
||||||
"contacts" : dList
|
"contacts" : dList
|
||||||
}
|
}
|
||||||
return jsonify(calendar_data=calendar_data)
|
return jsonify(calendar_data=calendar_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user