def update_bucketlist(id): if check_current_user() is True: form = BucketlistFormUpdate(request.form) if form.validate_on_submit(): global current_user bucketlist = models.Bucketlist() bucketlist.update_bucketlist(current_user[1], int(id), request.form.get("bucketlistname"), request.form.get("simple_description")) return redirect(url_for("user_bucket_lists")) else: return render_template("change_bucket_list.html", form=form) else: error = Markup("<div class='alert alert-danger' role='alert'>\ <strong>Login Required! </strong>You must be logged in to\ to access that page\ </div>") flash(error) return redirect(url_for("login"))
def setUp(self): self.tester = app.test_client(self) self.user1 = models.User() self.user1_bucketlist = models.Bucketlist() self.user1_bucketlist_activity = models.Bucketlist_Activities() models.all_users = {} #master user list models.all_bucketlists = {} #master bucketlist list models.all_bucketlists_activities = {} #master bucketlist activity
def delete_bucketlist(id): if check_current_user() is True: global current_user bucketlist = models.Bucketlist() bucketlist.delete_bucketlist(current_user[1], int(id)) return redirect(url_for("user_bucket_lists")) else: error = Markup("<div class='alert alert-danger' role='alert'>\ <strong>LLogin Required! </strong>You must be logged in to\ to access that page\ </div>") flash(error) return redirect(url_for("login"))
def create_bucketlist(): form = BucketlistForm() global current_user if request.method == "POST" and form.validate_on_submit(): bucketlist = models.Bucketlist() bucketlist.create_bucketlist(current_user[1], request.form.get("bucketlistname"), request.form.get("simple_description")) success = Markup("<div class='alert alert-success' role='alert'>\ <strong>Done! </strong>Your "+request.form.get("bucketlistname")+"\ Bucketlist is created.</div>") flash(success) return render_template('view_bucket_lists.html', bucketlists=all_bucketlists[current_user[1]], user=current_user) return render_template('view_bucket_lists.html', form=form)