Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sort_descending(request):
- sql = ""
- cursor = connection.cursor()
- cursor.execute(sql)
- result_search = cursor.fetchall()
- cursor.close()
- print(result_search)
- table = []
- for i in result_search:
- product_id = i[0]
- name = i[1]
- type = i[2]
- price = i[3]
- stock = i[4]
- warranty = i[5]
- row = {'product_id': product_id, 'name': name, 'type': type, 'warranty': warranty, 'price': price}
- table.append(row)
- print(table)
- return render(request, 'home.html', {'table': table})
- def sort_ascending(request):
- sql = ""
- cursor = connection.cursor()
- cursor.execute(sql)
- result_search = cursor.fetchall()
- cursor.close()
- print(result_search)
- table = []
- for i in result_search:
- product_id = i[0]
- name = i[1]
- type = i[2]
- price = i[3]
- stock = i[4]
- warranty = i[5]
- row = {'product_id': product_id, 'name': name, 'type': type, 'warranty': warranty, 'price': price}
- table.append(row)
- print(table)
- return render(request, 'home.html', {'table': table})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement