|
@ -73,9 +73,8 @@ def all(): |
|
|
return render_template('all.html', file=thefile, listingfiles=listingfiles, jsonfiles=jsonfiles, listofdicts=listofdicts, counter2=counter2) |
|
|
return render_template('all.html', file=thefile, listingfiles=listingfiles, jsonfiles=jsonfiles, listofdicts=listofdicts, counter2=counter2) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/description', methods=['GET', 'POST']) |
|
|
@app.route('/description') |
|
|
def description(): |
|
|
def description(): |
|
|
form = ReusableForm(request.form) |
|
|
|
|
|
#pick a file but that will be done an other way later |
|
|
#pick a file but that will be done an other way later |
|
|
thefile = listingfiles[positioninarray] #select one file from fullpath minus static/ |
|
|
thefile = listingfiles[positioninarray] #select one file from fullpath minus static/ |
|
|
|
|
|
|
|
@ -96,29 +95,10 @@ def description(): |
|
|
Your browser does not support the video tag. |
|
|
Your browser does not support the video tag. |
|
|
</video> ''') |
|
|
</video> ''') |
|
|
|
|
|
|
|
|
print (form.errors) |
|
|
|
|
|
if request.method == 'POST' and form.validate(): |
|
|
|
|
|
return 'Success!' |
|
|
|
|
|
# return render_template('description.html', form=form, file=thefile, listingdirectories=listingdirectories, listingfiles=listingfiles) |
|
|
# return render_template('description.html', form=form, file=thefile, listingdirectories=listingdirectories, listingfiles=listingfiles) |
|
|
return render_template('description.html', form=form, file=thefile) |
|
|
return render_template('description.html', file=thefile) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/get-data', methods=['GET', 'POST']) |
|
|
|
|
|
def savepost(): |
|
|
|
|
|
if request.method=='POST': |
|
|
|
|
|
dict={'id':listingdirectories[positioninarray][13:],'name':request.form['name'],'email':request.form['email'],'friend':request.form['friend'],'content':request.form['content']} |
|
|
|
|
|
# open with "a" if the file should concatenate content |
|
|
|
|
|
|
|
|
|
|
|
#json file naming gone unique by adding time and date of submission |
|
|
|
|
|
|
|
|
|
|
|
with open(listingdirectories[positioninarray]+"/"+now+"_data_file.json", "w") as write_file: |
|
|
|
|
|
json.dump(dict, write_file) |
|
|
|
|
|
return "The JSON file is ready." |
|
|
|
|
|
#throw description and next item, wee need to iterate through the files |
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
|
return "Error" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
app.run(debug=True) |
|
|
app.run(debug=True) |
|
|