def drafts(): if request.method == 'POST': model.parse_form(request.form) template_data = {"items": model.get_drafts()} # print("template data is:") # print(template_data) return render_template('drafts.html', data=template_data)
def feed(): if request.method == 'POST': if request.form['action'] == 'save': model.parse_form(request.form) if request.form['action'] == 'fetch': model.get_new_data('feed') template_data = {"items": model.get_lineup('feed')} return render_template('feed.html', data=template_data)
def feed(): if request.method == 'POST': if request.form['action'] == 'save': model.parse_form(request.form) if request.form['action'] == 'fetch': model.get_new_data() template_data = {"items": model.get_posts('published')} return render_template('feed.html', data=template_data, page_id='feed')
def view_entry(record_id): if request.method == 'POST': if request.form['action'] == 'save': # print("+++++++++++\nWe're in post method of drafts page") model.parse_form(request.form, "item") if request.form['action'] == 'cancel': return redirect(url_for('lineup')) template_data = model.get_record(s_id=record_id) # print(template_data) # template_data['modDate'] = (arrow.get(template_data['modDate'])).to('US/Eastern').format('YYYY-MM-DD h:mm a') # print(template_data) return render_template('item.html', data=template_data[0])
def lineup(): # get data if request.method == 'POST': if request.form['action'] == 'save': model.parse_form(request.form) if request.form['action'] == 'deploy': model.parse_form(request.form) data.build_template() fetch.put_S3() if request.form['action'] == 'fetch': model.get_new_data() template_data = {"items": model.get_lineup()} return render_template('lineup.html', data=template_data, draft_check=False)
def lineup(page_id): # get data # file_name = f'pages_{page_id}_lineup.html' if request.method == 'POST': if request.form['action'] == 'save': model.parse_form(request.form) if request.form['action'] == 'deploy': model.parse_form(request.form) data.build_template(page_id) fetch.put_S3( page_id ) # sometimes tries to send before file above finished writing!!!! # StackOverflow: https://stackoverflow.com/questions/36274868/saving-an-image-to-bytes-and-uploading-to-boto3-returning-content-md5-mismatch # My answer was to create using ".filename" then: # os.rename(filename.replace(".filename","filename")) # This ensured the file was done being created. if request.form['action'] == 'fetch': model.get_new_data(page_id) # template_data = {"items": model.get_lineup('published', page_id)} template_data = {"items": model.get_posts('published', page_id)} # return render_template(file_name, data=template_data, draft_check=False) return render_template('pages_lineup.html', data=template_data, page_id=page_id)