Commit 27dc41ff authored by Willard's avatar Willard

Reorganize classes in views.py

parent 74cd8246
......@@ -24,13 +24,6 @@ class FormView(View):
def render_get(self, **kwargs):
return ''
@app.route('/')
def index():
if current_user.is_authenticated:
return redirect(url_for('stalls'))
else:
return render_template('landing.html')
def not_logged_in(f):
@wraps(f)
def wrapper(*args, **kwargs):
......@@ -49,8 +42,6 @@ class LoginView(FormView):
def get_form(self):
return OwnerLoginForm()
app.add_url_rule('/login', view_func=LoginView.as_view('login'))
class RegisterView(FormView):
decorators=[not_logged_in]
def render_post(self):
......@@ -64,8 +55,14 @@ class RegisterView(FormView):
def get_form(self):
return OwnerRegisterForm()
app.add_url_rule('/login', view_func=LoginView.as_view('login'))
app.add_url_rule('/register', view_func=RegisterView.as_view('register'))
@app.route('/')
@not_logged_in
def index():
return render_template('landing.html')
@app.route('/logout')
def logout():
logout_user()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment