def post(self): model = dbmodel.get_model() # print(request.form['pictures']) file = request.files['picture'] description = request.form['description'] self.store_photo(model, file, description) return redirect(url_for('newsfeed'))
def post(self): model = dbmodel.get_model() follower = session['user_id'] followee_list = request.form.getlist('follow-check-box') for followee in followee_list: model.add_to_user_follow(follower, followee) return redirect(url_for('newsfeed'))
def __init__(self): """ Works with file in JSON self.filename = './scrape/url_data.json' f = open(self.filename) self.data = json.load(f) """ self.model = dbmodel.get_model() self.user = user self.max_tries = 5
def get(self): model = dbmodel.get_model() current_user = session['user_id'] metadata_list = model.get_media_metadata(current_user) current_user_photo = session['profile_photo'] return render_template("profile.html", metadata_list=metadata_list, current_user_photo=current_user_photo, current_user=current_user)
def post(self): model = dbmodel.get_model() user_input = {} user_input["email"] = request.form['email'] user_input["name"] = request.form['name'] user_input["username"] = request.form['username'] user_input["password"] = request.form['password'] file = request.files['picture'] self.store_photo(model, file, user_input) flash('sign up successful, please login to continue', 'info') return render_template('index.html')
def post(self): model = dbmodel.get_model() user_input = {} user_input["username"] = request.form['username'] user_input["password"] = request.form['password'] status = model.login(user_input) if status is True: session['user_id'] = user_input["username"] profile_photo = model.get_profile_photo(session['user_id']) session['profile_photo'] = profile_photo[0] return redirect(url_for('newsfeed', profile_photo=profile_photo)) else: flash('sign in failed, incorrect username or password', 'danger') return render_template('login.html')
def get(self): model = dbmodel.get_model() current_user = session['user_id'] current_user_photo = session['profile_photo'] feed = {} followee_profile_photo = {} followees = model.get_all_followees(current_user) for followee in followees: metadata_list = model.get_media_metadata(followee[1]) if metadata_list is not None: feed[followee[1]] = metadata_list profile_photo = model.get_profile_photo(followee[1]) followee_profile_photo[followee[1]] = profile_photo[0] return render_template('newsfeed.html', feed=feed, followee_profile_photo=followee_profile_photo, current_user_photo=current_user_photo, current_user=current_user)
def get(self): model = dbmodel.get_model() current_user = session['user_id'] current_user_photo = session['profile_photo'] users = model.get_suggested_followees(current_user) return render_template("explore.html", users=users, current_user_photo=current_user_photo, current_user=current_user)