コード例 #1
0
def route(methods, uri, route_string):
    # route string processing
    [controller, view_function_name] = route_string.split('@')
    view_func = getattr(controllers[controller], view_function_name)
    # methods processing
    if isinstance(methods, str):
        methods = [methods]
    methods = list(map(str.upper, methods))
    app.add_url_rule('/' + uri, view_func=view_func, methods=methods)
コード例 #2
0
from config import app
from server.controllers import developer

# developer
app.add_url_rule('/developer/register',
                 view_func=developer.dev_register_page,
                 endpoint="developer:register")
app.add_url_rule('/developer/login_page',
                 view_func=developer.dev_login_page,
                 endpoint="developer:login_page")
app.add_url_rule('/developer/create',
                 view_func=developer.dev_create,
                 endpoint="developer:create",
                 methods=['POST'])
app.add_url_rule('/developer/login',
                 view_func=developer.dev_login,
                 endpoint="developer:login",
                 methods=['POST'])
app.add_url_rule('/developer/logout',
                 view_func=developer.dev_logout,
                 endpoint="developer:logout")

#developer skill
app.add_url_rule('/developer/post/skills',
                 view_func=developer.dev_add_skill,
                 endpoint="developer:add_skill",
                 methods=['POST'])
コード例 #3
0
ファイル: routes.py プロジェクト: nakhem27/quotes_dash
from config import app
from controller_functions import home, register, login, dashboard, view_quotes_added_by_one_user, add_quote, like_quote, delete_quote, view_edit_account, update_account, logout

app.add_url_rule("/", view_func=home)
app.add_url_rule("/register", view_func=register, methods=["POST"])
app.add_url_rule("/login", view_func=login, methods=["POST"])
app.add_url_rule("/dashboard", view_func=dashboard, methods=["GET", "POST"])
app.add_url_rule("/user/<id>", view_func=view_quotes_added_by_one_user, methods=["POST"])
app.add_url_rule("/add_quote", view_func=add_quote, methods=["POST"])
app.add_url_rule("/like_quote", view_func=like_quote, methods=["POST"])
app.add_url_rule("/delete_quote", view_func=delete_quote, methods=["POST"])
app.add_url_rule("/myaccount/<id>", view_func=view_edit_account, methods=["POST"])
app.add_url_rule("/edit_account", view_func=update_account, methods=["POST"])
app.add_url_rule("/logout", view_func=logout, methods=["POST"])
コード例 #4
0
from config import app
from server.controllers import locations

app.add_url_rule('/location/<location_id>',
                 view_func=locations.view_location,
                 endpoint='locations:view_location',
                 methods=['POST', 'GET'])
app.add_url_rule('/location/<location_id>/like',
                 view_func=locations.like,
                 endpoint='locations:like',
                 methods=['POST', 'GET'])
app.add_url_rule('/location/<location_id>/remove_like',
                 view_func=locations.remove_like,
                 endpoint='locations:remove_like',
                 methods=['POST', 'GET'])

app.add_url_rule('/add_destination',
                 view_func=locations.add_destination,
                 endpoint='locations:add_destination',
                 methods=['POST', 'GET'])
app.add_url_rule('/remove_destination/<location_id>',
                 view_func=locations.remove_destination,
                 endpoint='locations:remove_destination',
                 methods=['POST', 'GET'])

app.add_url_rule('/route/<id>',
                 view_func=locations.route,
                 endpoint='locations:route')
コード例 #5
0
from config import app
from controller_functions import index, show_register_page, process_new_user, show_dashboard, show_login_page, login, \
    users_logout, show_post_form, post_article, show_user_posts, show_edit_user_post, edit_article, show_profile_page, \
    upload_file, uploaded_file, delete_article

app.add_url_rule("/", view_func=index)
app.add_url_rule("/register", view_func=show_register_page)

app.add_url_rule("/login", view_func=show_login_page)
app.add_url_rule("/login_user", view_func=login, methods=['POST'])
app.add_url_rule("/logout", view_func=users_logout, methods=["GET"])

app.add_url_rule("/process_new_user",
                 view_func=process_new_user,
                 methods=['POST'])
app.add_url_rule("/dashboard", view_func=show_dashboard)

app.add_url_rule("/post", view_func=show_post_form)
app.add_url_rule("/create_post", view_func=post_article, methods=['POST'])

app.add_url_rule("/profile/<id>", view_func=show_profile_page)
app.add_url_rule("/upload_file", view_func=upload_file, methods=["POST"])
app.add_url_rule("/uploaded/<profile_pic>", view_func=uploaded_file)
app.add_url_rule("/user/posts/<id>", view_func=show_user_posts)
app.add_url_rule("/user/posts/edit/<id>", view_func=show_edit_user_post)
app.add_url_rule("/edit_post/<id>", view_func=edit_article, methods=['POST'])
app.add_url_rule("/user/posts/delete/<id>", view_func=delete_article)
コード例 #6
0
ファイル: routes.py プロジェクト: mwiltzius/dojo_tweets
from config import app
from controller_functions import *

app.add_url_rule('/', view_func=index)
app.add_url_rule('/register', view_func=process, methods=['POST'])
app.add_url_rule('/login', view_func=login, methods=['POST'])
app.add_url_rule('/dashboard', view_func=active)
app.add_url_rule('/logout', view_func=logout)
app.add_url_rule('/tweets/create', view_func=create_tweet, methods=['POST'])
app.add_url_rule('/tweets/<id>/add_like', view_func=add_like, methods=['POST'])
app.add_url_rule('/tweets/<id>/delete',
                 view_func=delete_tweet,
                 methods=['POST'])
app.add_url_rule('/tweets/<id>/edit', view_func=edit_tweet)
app.add_url_rule('/tweets/<id>/update',
                 view_func=update_tweet,
                 methods=['POST'])
app.add_url_rule('/users', view_func=show_user_list)
app.add_url_rule('/users/<id>/follow', view_func=follow_user, methods=['POST'])

app.add_url_rule('/email', view_func=check_email, methods=['POST'])
コード例 #7
0
from config import app
import controllers



#dashboard
app.add_url_rule('/', view_func=controllers.root, endpoint='root')
app.add_url_rule('/dashboard', view_func=controllers.dashboard, endpoint='dashboard')


#users
app.add_url_rule('/users/new', view_func=controllers.new_user, endpoint='users:new_user')
app.add_url_rule('/users/create', view_func=controllers.create_user, endpoint='users:create_user', methods=['POST'])
app.add_url_rule('/users/login', view_func=controllers.login, endpoint='users:login', methods=['POST'])
app.add_url_rule('/users/logout', view_func=controllers.logout, endpoint='users:logout')
app.add_url_rule('/users/<id>/poke', view_func=controllers.poke)
コード例 #8
0
from config import app
from controller_functions import index, show_register_page, process_new_user, show_dashboard, show_login_page, login, \
    show_channels_page,create_new_channel,users_logout, show_channel_messages

app.add_url_rule("/", view_func=index)
app.add_url_rule("/register", view_func=show_register_page)

app.add_url_rule("/login", view_func=show_login_page)
app.add_url_rule("/login_user", view_func=login, methods=['POST'])
app.add_url_rule("/logout", view_func=users_logout, methods=["GET"])

app.add_url_rule("/process_new_user",
                 view_func=process_new_user,
                 methods=['POST'])
app.add_url_rule("/dashboard", view_func=show_dashboard)

app.add_url_rule("/channels", view_func=show_channels_page)
app.add_url_rule("/create_channel",
                 view_func=create_new_channel,
                 methods=['POST'])

app.add_url_rule("/channnel/<channel_id>",
                 view_func=show_channel_messages,
                 methods=['GET', 'POST'])
コード例 #9
0
from config import app
from controllers import *

app.add_url_rule('/', view_func=home)
コード例 #10
0
ファイル: routes.py プロジェクト: tinluong28/dojo_tweets
from config import app
from controller_functions import registration, signup, login, users, followers, follow, unfollow, dashboard, tweet, like_tweet, unlike_tweet, edit_tweet, update_tweet, delete_tweet, logout

app.add_url_rule('/registration', view_func=registration)
app.add_url_rule('/signup', view_func=signup, methods=['POST'])
app.add_url_rule('/login', view_func=login, methods=['POST'])
app.add_url_rule('/users', view_func=users)
app.add_url_rule('/followers', view_func=followers)
app.add_url_rule('/<followed_user>/follow', view_func=follow)
app.add_url_rule('/<followed_user>/unfollow', view_func=unfollow)
app.add_url_rule('/dashboard', view_func=dashboard)
app.add_url_rule('/tweet', view_func=tweet, methods=['POST'])
app.add_url_rule('/tweets/<tweet_id>/like', view_func=like_tweet)
app.add_url_rule('/tweets/<tweet_id>/unlike', view_func=unlike_tweet)
app.add_url_rule('/tweets/<tweet_id>/edit', view_func=edit_tweet)
app.add_url_rule('/tweets/<tweet_id>/update_tweet',
                 view_func=update_tweet,
                 methods=['POST'])
app.add_url_rule('/tweets/<tweet_id>/delete', view_func=delete_tweet)
app.add_url_rule('/tweets/<tweet_id>/delete', view_func=logout)
コード例 #11
0
from config import app, render_template
from server.controllers import root

@app.errorhandler(404)
def page_not_found(error):
    return render_template('page_not_found.html'), 404

app.add_url_rule('/portfolio', view_func=root.portfolio)
app.add_url_rule('/', view_func=root.index)
app.add_url_rule('/portfolio/alerts', view_func=root.alerts)
コード例 #12
0
from config import app
from functions import Views

view = Views()

app.add_url_rule("/", "home", view.home, methods=["GET"])

app.add_url_rule("/add_user",
                 "register",
                 view.register,
                 methods=["GET", "POST"])

app.add_url_rule("/create_post",
                 "create_post",
                 view.create_post,
                 methods=["GET", "POST"])

app.add_url_rule("/get_profile", "login", view.login, methods=["GET", "POST"])

app.add_url_rule("/posts", "rooms_list", view.rooms_list, methods=["GET"])

app.add_url_rule("/posts/<int:id>",
                 "rooms_detail",
                 view.rooms_detail,
                 methods=["GET"])

app.add_url_rule("/post_author/<int:id>",
                 "post_author",
                 view.post_author,
                 methods=["GET"])
コード例 #13
0
ファイル: routes.py プロジェクト: rnwanety/quote_dash
from config import app
from controller_functions import default, register, login, index, add_a_quote, like_quote, user_page, myaccount, edit_account, delete_quote, logout
app.add_url_rule("/", view_func=default)
app.add_url_rule("/register", view_func=register, methods=["POST"])
app.add_url_rule("/login", view_func=login, methods=["POST"])
app.add_url_rule("/quotes", view_func=index)
app.add_url_rule("/add_a_quote", view_func=add_a_quote, methods=["POST"])
app.add_url_rule("/like/<quote_id>", view_func=like_quote)
app.add_url_rule("/user/<user_id>", view_func=user_page)
app.add_url_rule("/myaccount/<user_id>", view_func=myaccount)
app.add_url_rule("/edit_account", view_func=edit_account, methods=["POST"])
app.add_url_rule("/delete/<quote_id>", view_func=delete_quote)
app.add_url_rule("/logout", view_func=logout)
コード例 #14
0
from config import app
from server.controllers import songs

app.add_url_rule('/listen', view_func=songs.records, endpoint='songs:records')
app.add_url_rule('/song/play', view_func=songs.play, endpoint='songs:play')
コード例 #15
0
from config import app
from controller_functions import index, add

app.add_url_rule("/", view_func=index)
app.add_url_rule("/add", view_func=add, methods=['POST'])
コード例 #16
0
ファイル: app.py プロジェクト: tadam93/sudsdb
from static_routes import StaticRouter
from search_routes import SearchRouter
from details_routes import DetailRouter

import subprocess
import api
import re
import sys


@app.route('/<path:path>')
def static_proxy(path):
  return app.send_static_file(path)

app.add_url_rule('/', StaticRouter.index)
app.add_url_rule('/about', StaticRouter.about)
app.add_url_rule('/breweries', StaticRouter.breweries)
app.add_url_rule('/beers', StaticRouter.beers)
app.add_url_rule('/styles', StaticRouter.styles)

app.add_url_rule('/search/<string:terms>', SearchRoutes.search)

app.add_url_rule('/beers/<int:beer>', DetailRouter.beer)
app.add_url_rule('/breweries/<int:brewery>', DetailRouter.brewery)
app.add_url_rule('/styles/<int:style>', DetailRouter.style)


@app.route('/api/beers', methods=["GET"])
def beers():
    return jsonify({'beers': list(map(api.get_beer_details, Beer.query.all()))})
コード例 #17
0
ファイル: routes.py プロジェクト: jetakasabaqi/money_tracker
from flask import Flask
from config import app
from controller_functions import (landing_page, register, login, on_register,
                                  on_login, logout, home, create_expense,
                                  viewAllExpences, filterExpense, editExpense,
                                  deleteExpense, editExpenseForm, todo,
                                  create_todo, checkToDo, uncheckToDo,
                                  destroyToDo, editToDo)

app.add_url_rule("/", view_func=landing_page)
app.add_url_rule("/register", view_func=register)
app.add_url_rule("/login", view_func=login)
app.add_url_rule('/home', view_func=home)
app.add_url_rule("/register_user", view_func=on_register, methods=['POST'])
app.add_url_rule("/login_user", view_func=on_login, methods=['POST'])
app.add_url_rule("/logout", view_func=logout)
app.add_url_rule("/create_expense", view_func=create_expense, methods=['POST'])
app.add_url_rule("/view_all", view_func=viewAllExpences)
app.add_url_rule("/edit/<id>", view_func=editExpense)
app.add_url_rule("/edit-expense", view_func=editExpenseForm, methods=['POST'])
app.add_url_rule("/delete/<ex_id>", view_func=deleteExpense)
app.add_url_rule("/filter-expense", view_func=filterExpense, methods=['POST'])
app.add_url_rule("/toDoList", view_func=todo)
app.add_url_rule("/create-todo", view_func=create_todo, methods=['POST'])
app.add_url_rule("/check-todo/<int:todo_id>", view_func=checkToDo)
app.add_url_rule("/uncheck-todo/<int:todo_id>", view_func=uncheckToDo)
app.add_url_rule("/destroy-todo/<int:todo_id>", view_func=destroyToDo)
app.add_url_rule("/edit-todo/<int:todo_id>",
                 view_func=editToDo,
                 methods=['POST'])
コード例 #18
0
from config import app
from controller_functions import index, dojos, destroy_dojo, create_dojo, ninjas, destroy_ninja, create_ninja

app.add_url_rule('/', view_func=index)
app.add_url_rule('/dojos', view_func=dojos)
app.add_url_rule('/dojos/<id>/destroy', view_func=destroy_dojo)
app.add_url_rule('/create-dojo', view_func=create_dojo, methods=['POST'])
app.add_url_rule('/ninjas', view_func=ninjas)
app.add_url_rule('/ninjas/<id>/destroy', view_func=destroy_ninja)
app.add_url_rule('/create-ninja', view_func=create_ninja,  methods=['POST'])
コード例 #19
0
from config import app
from controller_functions import *

app.add_url_rule("/", view_func=index)
app.add_url_rule("/users/create", methods=["POST"], view_func=register)
app.add_url_rule("/users/login", methods=["POST"], view_func=login)
app.add_url_rule("/logout", view_func=logout)
app.add_url_rule("/products", view_func=products)
app.add_url_rule("/orders", methods=["POST"], view_func=orders)
app.add_url_rule("/orders/confirmation", view_func=confirmation)
app.add_url_rule("/orders/confirm",
                 methods=["POST"],
                 view_func=place_transaction)
app.add_url_rule("/orders/cancel", view_func=cancel_order)

# app.add_url_rule("/dashboard", view_func=dashboard)
# app.add_url_rule("/posts/create", methods=["POST"], view_func=new_post)
# app.add_url_rule("/posts/<post_id>/show", view_func=show_post)
# app.add_url_rule("/posts/<post_id>/update", methods=["POST"], view_func=update_post)
# app.add_url_rule("/posts/<post_id>/delete", view_func=delete_post)
# app.add_url_rule("/likes/<post_id>", view_func=add_like)
コード例 #20
0
ファイル: routes.py プロジェクト: eashur/python_stack
from config import app
from controller_functions import index, newdojo, newuser

app.add_url_rule("/", view_func=index)
app.add_url_rule("/add_dojo", view_func=newdojo, methods=["POST"])
app.add_url_rule("/add_ninja", view_func=newuser, methods=["POST"])

# @app.route("/")

# @app.route("/add_dojo", methods =["POST"])

# @app.route("/add_ninja", methods =["POST"])
コード例 #21
0
from config import app
from controller_functions import index, register, login, home, registration_page, logout, account, order, update_user

app.add_url_rule("/", view_func=index)
app.add_url_rule("/register", view_func=register, methods=["POST"])
app.add_url_rule("/login", view_func=login, methods=["POST"])
app.add_url_rule("/home", view_func=home)
app.add_url_rule("/registration", view_func=registration_page)
app.add_url_rule("/logout", view_func=logout)
app.add_url_rule("/account", view_func=account)
app.add_url_rule("/account/update", view_func=update_user, methods=["POST"])
app.add_url_rule("/order", view_func=order)
コード例 #22
0
from config import app
from server.controllers import users

app.add_url_rule('/user/register',
                 view_func=users.register,
                 endpoint='users:register')
app.add_url_rule('/user/create',
                 view_func=users.create,
                 methods=['POST'],
                 endpoint='users:create')
app.add_url_rule('/user/thankyou',
                 view_func=users.thankyou,
                 endpoint='users:thankyou')
app.add_url_rule('/user/login', view_func=users.login, endpoint='users:login')
app.add_url_rule('/user/my_account',
                 view_func=users.my_account,
                 endpoint='users:my_account')
app.add_url_rule('/user/update/<id>',
                 view_func=users.update,
                 methods=['POST'],
                 endpoint='users:update')
app.add_url_rule('/user/process_login',
                 view_func=users.process_login,
                 methods=['POST'],
                 endpoint='users:process_login')
app.add_url_rule('/user/welcome',
                 view_func=users.welcome,
                 endpoint='users:welcome')
app.add_url_rule('/user/logout',
                 view_func=users.logout,
                 endpoint='users:logout')
コード例 #23
0
ファイル: users.py プロジェクト: BritneyAC/QuindittyArt
from config import app
from server.controllers import users

app.add_url_rule('/users/new', view_func=users.new, endpoint="users:new")
app.add_url_rule('/users/create',
                 view_func=users.create,
                 endpoint="users:create",
                 methods=['POST'])
app.add_url_rule('/users/login',
                 view_func=users.login,
                 endpoint="users:login",
                 methods=['POST'])
app.add_url_rule('/users/logout',
                 view_func=users.logout,
                 endpoint="users:logout")
app.add_url_rule('/users/<user_id>',
                 view_func=users.users_quotes,
                 endpoint='users:users_quotes')
app.add_url_rule('/users/<user_id>/edit',
                 view_func=users.edit,
                 endpoint='users:edit',
                 methods=['POST', 'GET'])
app.add_url_rule('/users/<user_id>/editing',
                 view_func=users.editing,
                 endpoint='users:editing',
                 methods=['POST', 'GET'])
app.add_url_rule('/admin_page',
                 view_func=users.admin_page,
                 endpoint='admin_page')
app.add_url_rule('/admin_lvl_increase/<user_id>',
                 view_func=users.admin_lvl_increase,
コード例 #24
0
from config import app
from server.controllers import ideas

app.add_url_rule('/portfolio/ideas_app/bright_ideas', view_func=ideas.ideas, endpoint="ideas:ideas")
app.add_url_rule('/portfolio/ideas_app/bright_ideas/list', view_func=ideas.ideas_list, endpoint="ideas:ideas_list")
app.add_url_rule('/portfolio/ideas_app/bright_ideas/<id>', view_func=ideas.view, methods=['GET'], endpoint="ideas:view")
app.add_url_rule('/portfolio/ideas_app/bright_ideas/create', view_func=ideas.create, methods=['POST'], endpoint="ideas:create")
app.add_url_rule('/portfolio/ideas_app/bright_ideas/edit/<id>', view_func=ideas.edit, methods=['GET'], endpoint="ideas:edit")
app.add_url_rule('/portfolio/ideas_app/bright_ideas/update/<id>', view_func=ideas.update, methods=['POST'], endpoint="ideas:update")
app.add_url_rule('/portfolio/ideas_app/bright_ideas/delete/<id>', view_func=ideas.delete, methods=['POST'], endpoint="ideas:delete")
app.add_url_rule('/portfolio/ideas_app/bright_ideas/like/<id>', view_func=ideas.like_idea, methods=['POST'], endpoint="ideas:like_idea")
コード例 #25
0
ファイル: routes.py プロジェクト: ElisaMehta/CSS
from config import app
from controller import main, add_user, login, logout, color

app.add_url_rule("/", view_func=main)
app.add_url_rule("/process/user", view_func=add_user, methods=['POST'])
app.add_url_rule("/login", view_func=login, methods=['POST'])
app.add_url_rule("/logout", view_func=logout)
app.add_url_rule("/color", view_func=color)
コード例 #26
0
ファイル: utils.py プロジェクト: lcruz/Portal-empleo
def register_api(view, endpoint, url, pk='key'):
	view_func = view.as_view(endpoint)
	app.add_url_rule(url, defaults={'key' : None}, view_func=view_func, methods=['GET', 'POST'])	
	app.add_url_rule('%s<%s>' % (url, pk), view_func=view_func, methods=['GET', 'PUT', 'DELETE'])
コード例 #27
0
ファイル: routes.py プロジェクト: donikatomi/money_tracker
from flask import Flask
from config import app
from controller_functions import (landing_page, register, login, on_register,
                                  on_login, logout)

app.add_url_rule("/", view_func=landing_page)
app.add_url_rule("/register", view_func=register)
app.add_url_rule("/login", view_func=login)
app.add_url_rule("/register_user", view_func=on_register, methods=['POST'])
app.add_url_rule("/login_user", view_func=on_login, methods=['POST'])
app.add_url_rule("/logout", view_func=logout)
コード例 #28
0
from config import app
from controller_functions import index, add_newuser, login, logout, follow

app.add_url_rule("/", view_func=index)
app.add_url_rule("/register", view_func=add_newuser, methods=["POST"])
app.add_url_rule("/login", view_func=login, methods=["POST"])
app.add_url_rule("/follow", view_func=follow, methods=["POST"])
app.add_url_rule("/", view_func=logout)
コード例 #29
0
from config import app
from controller_functions import index, register_new_user, username, login_page, validate_login, success, add_entry, logout, edit_landing, update_prof

app.add_url_rule("/", view_func=index)
app.add_url_rule("/register", view_func=register_new_user, methods=["POST"])
app.add_url_rule("/email", view_func=username, methods=["POST"])
app.add_url_rule("/login_page", view_func=login_page)
app.add_url_rule("/login", view_func=validate_login, methods=["POST"])
app.add_url_rule("/home", view_func=success)
app.add_url_rule("/add_entry", view_func=add_entry, methods=["POST"])
app.add_url_rule("/logout", view_func=logout)
app.add_url_rule("/edit_profile", view_func=edit_landing)
app.add_url_rule("/update_user", view_func=update_prof, methods=["POST"])
コード例 #30
0
from config import app
from controller_functions import *

app.add_url_rule("/", view_func=index)
app.add_url_rule("/users/create", methods=["POST"], view_func=register)
app.add_url_rule("/users/login", methods=["POST"], view_func=login)
app.add_url_rule("/users/<user_id>/delete", view_func=delete_account)
app.add_url_rule("/logout", view_func=logout)

app.add_url_rule("/dashboard", view_func=dashboard)
app.add_url_rule("/posts/create", methods=["POST"], view_func=new_post)
app.add_url_rule("/posts/<post_id>/show", view_func=show_post)
app.add_url_rule("/posts/<post_id>/update", methods=["POST"], view_func=update_post)
app.add_url_rule("/posts/<post_id>/delete", view_func=delete_post)
app.add_url_rule("/likes/<post_id>", view_func=add_like)
コード例 #31
0
ファイル: routes.py プロジェクト: Delrorak/temp_template
from config import app
from controller_functions import route_to_index, register_new_user, login_process, user_dashboard, logout, edit_account, update_user, add_quote, user_posted_quotes, delete_quote, likes

app.add_url_rule('/', view_func=route_to_index)

app.add_url_rule('/register', view_func=register_new_user, methods=['POST'])

app.add_url_rule('/login', view_func=login_process, methods=['POST'])

app.add_url_rule('/user_dashboard/<id>', view_func=user_dashboard)

app.add_url_rule('/logout', view_func=logout)

app.add_url_rule('/edit_account/<id>', view_func=edit_account)

app.add_url_rule('/update_user/<id>', view_func=update_user, methods=['POST'])

app.add_url_rule('/add_quote/<id>', view_func=add_quote, methods=['POST'])

app.add_url_rule('/user_posted_quotes/<id>,<user_that_posted_id>',
                 view_func=user_posted_quotes)

app.add_url_rule('/delete_quote/<user_id>,<quote_id>',
                 view_func=delete_quote,
                 methods=['POST'])

app.add_url_rule('/likes/<user_id>,<quote_id>',
                 view_func=likes,
                 methods=['POST'])
コード例 #32
0
from config import app
from controller_functions import index, new_acc, reg_fname, reg_lname, reg_email_check, reg_pw, reg_pw_match, login, logout, userprofile, editprofile, editpassword, userpage, validate_create_idea, delete_idea, edit_page, edit_idea, like, unlike, details, users, add_friend, remove_friend

app.add_url_rule("/", view_func=index)
app.add_url_rule("/register", view_func=new_acc, methods=["POST"])
app.add_url_rule("/reg_fname", view_func=reg_fname, methods=["POST"])
app.add_url_rule("/reg_lname", view_func=reg_lname, methods=["POST"])
app.add_url_rule("/reg_email_check",
                 view_func=reg_email_check,
                 methods=["POST"])
app.add_url_rule("/reg_pw", view_func=reg_pw, methods=["POST"])
app.add_url_rule("/reg_pw_match", view_func=reg_pw_match, methods=["POST"])
app.add_url_rule("/login", view_func=login, methods=["POST"])
app.add_url_rule("/logout", view_func=logout)
app.add_url_rule("/userprofile/<user_id>", view_func=userprofile)
app.add_url_rule("/editprofile", view_func=editprofile, methods=["POST"])
app.add_url_rule("/editpassword", view_func=editpassword, methods=["POST"])
app.add_url_rule("/userpage", view_func=userpage)
app.add_url_rule("/create_idea",
                 view_func=validate_create_idea,
                 methods=["POST"])
app.add_url_rule("/delete_idea/<idea_id>", view_func=delete_idea)
app.add_url_rule("/edit_idea/<idea_id>", view_func=edit_page)
app.add_url_rule("/confirm_idea_edit/<idea_id>",
                 view_func=edit_idea,
                 methods=["POST", "GET"])
app.add_url_rule("/like_idea/<idea_id>", view_func=like)
app.add_url_rule("/unlike_idea/<idea_id>", view_func=unlike)
app.add_url_rule("/details/<idea_id>", view_func=details)
app.add_url_rule("/users", view_func=users)
app.add_url_rule("/add_friend/<user_id>", view_func=add_friend)
コード例 #33
0
ファイル: app.py プロジェクト: mitulshah44/flask_crud_app
    Viewpage class is easy to access where
    we can defind get post put method
    using class method
    """
    def get(self):
        data['title'] = "List of Member"
        # g.db = connect_db()
        # cur = g.db.execute('select * from userdata')
        # usrdata = [dict(username=row[0], email=row[1])
        #            for row in cur.fetchall()]
        # g.db.close()
        usrdata = db.session.query(User).all()
        print usrdata
        return render_template('member.html', data=data, userdata=usrdata)

app.add_url_rule('/member', view_func=Indexpage.as_view('main'),
                 methods=['GET', 'POST'])


class AddMember(views.MethodView):
    """
    Add new member using post method
    url /AddMember
    """
    def post(self):
        data['title'] = "Subscription"
        data['message'] = "POST Method is called."
        data['content'] = email = request.form['email']
        uname = request.form['username']

        # insert email into database
        try: