Skip to content

Commit 9402569

Browse files
committed
Now with client side validation too.
1 parent d2d4bb3 commit 9402569

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/ch13-validation/final/pypi_org/templates/account/register.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
<form action="" method="POST" class="account-form">
77
<h1>Register at PyPI</h1>
88

9-
<input name="name" type="text" placeholder=" Your name" class="form-control" value="{{ name }}">
10-
<input name="email" type="text" placeholder=" Your email address" class="form-control" value="{{ email }}">
11-
<input name="password" type="password" placeholder=" Password" class="form-control" value="{{ password }}">
9+
<input name="name" type="text" placeholder=" Your name" class="form-control" value="{{ name }}" required>
10+
<input name="email" type="email" placeholder=" Your email address" class="form-control" value="{{ email }}" required>
11+
<input name="password" type="password" placeholder=" Password" class="form-control" value="{{ password }}" required>
12+
<input name="age" type="number" min="18" max="120" required placeholder=" Your age in years" style="display: block; width: 100%">
1213
<button type="submit" class="btn btn-danger">Register</button>
1314
<div style="clear: both;"></div>
1415

app/ch13-validation/final/pypi_org/viewmodels/account/register_viewmodel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def __init__(self):
88
self.name = self.request_dict.name
99
self.email = self.request_dict.email.lower().strip()
1010
self.password = self.request_dict.password.strip()
11+
self.age = self.request_dict.age.strip()
1112

1213
def validate(self):
1314
if not self.name or not self.name.strip():

0 commit comments

Comments
 (0)