Track items sold and graph profit for player shop inventory.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
993 B

6 years ago
  1. import re
  2. from flask import (
  3. request,
  4. url_for,
  5. redirect,
  6. render_template
  7. )
  8. from . import (
  9. db,
  10. app,
  11. models,
  12. shop
  13. )
  14. @app.route('/')
  15. def shop_dashboard():
  16. return render_template('shop_dashboard.html',
  17. products=models.ShopProduct.query.all())
  18. @app.route('/shop/data', methods=['POST','GET'])
  19. def shop_dataentry():
  20. if request.method == 'POST':
  21. if request.form.get('password') == 'r3m3di3s' and request.form.get('mission-data'):
  22. data = request.form['mission-data']
  23. clean_data = data.replace('\r\n', '\n')
  24. shop.parse_shop_output(clean_data)
  25. return redirect(url_for('shop_dashboard'))
  26. return render_template('shop_dataentry.html')
  27. @app.route('/shop/product/<int:product_id>')
  28. def shop_product_entries(product_id):
  29. product = models.ShopProduct.query.filter_by(id=product_id).first_or_404()
  30. return render_template('shop_product_entries.html', product=product)