Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS123-Canteeneo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Willard Torres
CS123-Canteeneo
Commits
27dc41ff
Commit
27dc41ff
authored
Nov 11, 2016
by
Willard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorganize classes in views.py
parent
74cd8246
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
views.py
canteeneo/views.py
+6
-9
No files found.
canteeneo/views.py
View file @
27dc41ff
...
@@ -24,13 +24,6 @@ class FormView(View):
...
@@ -24,13 +24,6 @@ class FormView(View):
def
render_get
(
self
,
**
kwargs
):
def
render_get
(
self
,
**
kwargs
):
return
''
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
):
def
not_logged_in
(
f
):
@
wraps
(
f
)
@
wraps
(
f
)
def
wrapper
(
*
args
,
**
kwargs
):
def
wrapper
(
*
args
,
**
kwargs
):
...
@@ -49,8 +42,6 @@ class LoginView(FormView):
...
@@ -49,8 +42,6 @@ class LoginView(FormView):
def
get_form
(
self
):
def
get_form
(
self
):
return
OwnerLoginForm
()
return
OwnerLoginForm
()
app
.
add_url_rule
(
'/login'
,
view_func
=
LoginView
.
as_view
(
'login'
))
class
RegisterView
(
FormView
):
class
RegisterView
(
FormView
):
decorators
=
[
not_logged_in
]
decorators
=
[
not_logged_in
]
def
render_post
(
self
):
def
render_post
(
self
):
...
@@ -64,8 +55,14 @@ class RegisterView(FormView):
...
@@ -64,8 +55,14 @@ class RegisterView(FormView):
def
get_form
(
self
):
def
get_form
(
self
):
return
OwnerRegisterForm
()
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
.
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'
)
@
app
.
route
(
'/logout'
)
def
logout
():
def
logout
():
logout_user
()
logout_user
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment