|
@@ -5,6 +5,8 @@ from .models import User
|
|
|
from . import db
|
|
from . import db
|
|
|
|
|
|
|
|
from . import clean_file as cf
|
|
from . import clean_file as cf
|
|
|
|
|
+from . import tools
|
|
|
|
|
+from . import dispatch
|
|
|
|
|
|
|
|
dashboards = Blueprint('dashboards', __name__)
|
|
dashboards = Blueprint('dashboards', __name__)
|
|
|
|
|
|
|
@@ -35,22 +37,32 @@ def profile():
|
|
|
return render_template('profile.html', user=current_user)
|
|
return render_template('profile.html', user=current_user)
|
|
|
|
|
|
|
|
@dashboards.route('/create_art', methods=['GET', 'POST'])
|
|
@dashboards.route('/create_art', methods=['GET', 'POST'])
|
|
|
-#login_required
|
|
|
|
|
|
|
+@login_required
|
|
|
def create():
|
|
def create():
|
|
|
# check POST req
|
|
# check POST req
|
|
|
if request.method == "POST":
|
|
if request.method == "POST":
|
|
|
new_art = request.files.get('art_img')
|
|
new_art = request.files.get('art_img')
|
|
|
|
|
+ art_name = request.form.get('art_name')
|
|
|
|
|
+ art_desc = request.form.get('description')
|
|
|
|
|
+ min_price = request.form.get('minimum_price')
|
|
|
|
|
+ buyout_price = request.form.get('buyout_price')
|
|
|
|
|
+ close_date = request.form.get('closing_date')
|
|
|
|
|
|
|
|
- if new_art and new_art.filename != '' and cf.allowed_file(new_art.filename):
|
|
|
|
|
- new_art.save(f'{cf.UPLOAD_FOLDER}/{cf.sanitize(new_art.filename)}')
|
|
|
|
|
|
|
+ if tools.check_fields([new_art, art_name, min_price, buyout_price, close_date]):
|
|
|
|
|
+ if new_art and new_art.filename != '' and cf.allowed_file(new_art.filename):
|
|
|
|
|
+ designated_fn = cf.sanitize(new_art.filename)
|
|
|
|
|
+ new_art.save(f'{cf.UPLOAD_FOLDER}/{designated_fn}')
|
|
|
|
|
+ dispatch.mint(designated_fn, art_name, art_desc, min_price, buyout_price, close_date)
|
|
|
|
|
|
|
|
return render_template('create_art.html', user=current_user)
|
|
return render_template('create_art.html', user=current_user)
|
|
|
|
|
|
|
|
# Pop Ups
|
|
# Pop Ups
|
|
|
@dashboards.route('/modal_home')
|
|
@dashboards.route('/modal_home')
|
|
|
|
|
+@login_required
|
|
|
def modal_home():
|
|
def modal_home():
|
|
|
return render_template('detail_art_for_home.html', user=current_user)
|
|
return render_template('detail_art_for_home.html', user=current_user)
|
|
|
|
|
|
|
|
@dashboards.route('/modal_profile')
|
|
@dashboards.route('/modal_profile')
|
|
|
|
|
+@login_required
|
|
|
def modal_profile():
|
|
def modal_profile():
|
|
|
return render_template('detail_art_for_profile.html', user=current_user)
|
|
return render_template('detail_art_for_profile.html', user=current_user)
|