Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Flask_User_Reg
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mitchell Moore
Flask_User_Reg
Commits
6ad35f2d
Commit
6ad35f2d
authored
5 years ago
by
Mitchell Moore
Browse files
Options
Downloads
Patches
Plain Diff
test form simplification
parent
146d845b
No related branches found
Branches containing commit
No related tags found
1 merge request
!20
Fix form functionality
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/__init__.py
+34
-19
34 additions, 19 deletions
app/__init__.py
with
34 additions
and
19 deletions
app/__init__.py
+
34
−
19
View file @
6ad35f2d
...
...
@@ -10,7 +10,9 @@ import time
# third-party imports
from
flask
import
Flask
,
redirect
,
url_for
,
request
,
render_template
,
flash
from
flask_wtf
import
FlaskForm
from
flask_bootstrap
import
Bootstrap
from
wtforms
import
StringField
,
SubmitField
def
create_app
(
config_name
):
...
...
@@ -21,30 +23,43 @@ def create_app(config_name):
global
return_url
return_url
=
''
class
MainForm
(
FlaskForm
):
fullname
=
StringField
(
'
Username:
'
,
[
validators
.
DataRequired
(),
])
submit
=
SubmitField
(
'
Submit
'
)
@app.route
(
'
/
'
,
methods
=
[
'
GET
'
,
'
POST
'
])
def
index
():
user
=
request
.
remote_user
if
request
.
method
==
'
GET
'
:
global
return_url
if
"
redir
"
in
request
.
args
:
return_url
=
request
.
args
.
get
(
"
redir
"
)
or
"
/pun/sys/dashboard
"
return
render_template
(
"
auth/SignUp.html
"
,
user
=
user
)
if
request
.
method
==
'
POST
'
:
name
=
request
.
form
[
'
name
'
]
if
name
!=
""
:
return
redirect
(
url_for
(
'
success
'
,
username
=
str
(
user
),
fullname
=
name
))
else
:
return
render_template
(
"
auth/SignUp.html
"
,
user
=
user
)
username
=
False
form
=
MainForm
()
if
form
.
validate_on_submit
():
username
=
form
.
username
.
data
form
.
username
.
data
=
''
return
redirect
(
url_for
(
'
success
'
,
username
=
str
(
user
),
fullname
=
name
))
return
render_template
(
'
auth/SignUp.html
'
,
form
=
form
,
user
=
user
)
# if request.method == 'GET':
#
# global return_url
#
# if "redir" in request.args:
# return_url = request.args.get("redir") or "/pun/sys/dashboard"
#
# return render_template("auth/SignUp.html", user=user)
#
# if request.method == 'POST':
#
# name = request.form['name']
#
# if name != "":
#
# return redirect(url_for('success', username=str(user), fullname=name))
#
# else:
# return render_template("auth/SignUp.html", user=user)
@app.route
(
'
/success/<username>/<fullname>
'
)
def
success
(
username
,
fullname
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment