Refactor: use Flask class based views
This commit is contained in:
parent
d5b972e9e3
commit
093e1d415d
|
@ -1,8 +1,15 @@
|
||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template
|
||||||
|
from flask.views import View
|
||||||
|
|
||||||
|
|
||||||
core = Blueprint('core', __name__)
|
core = Blueprint('core', __name__)
|
||||||
|
|
||||||
|
|
||||||
@core.route('/profile/')
|
class UserProfileView(View):
|
||||||
def user_profile():
|
template_name = 'ereuse_devicehub/user_profile.html'
|
||||||
return render_template('ereuse_devicehub/user_profile.html')
|
|
||||||
|
def dispatch_request(self):
|
||||||
|
return render_template(self.template_name)
|
||||||
|
|
||||||
|
|
||||||
|
core.add_url_rule('/profile/', view_func=UserProfileView.as_view('user-profile'))
|
||||||
|
|
Reference in New Issue