Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit a51d635

Browse files
committed
fix Dockerfile in 1.0-initialapp
1 parent c85a441 commit a51d635

File tree

7 files changed

+9
-47
lines changed

7 files changed

+9
-47
lines changed

Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM tiangolo/uwsgi-nginx-flask:python3.6
22

33
COPY requirements.txt /
44

5+
WORKDIR /
6+
57
RUN pip install -r ./requirements.txt --no-cache-dir
68

79
COPY app/ /app/

app/app.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ def view_registration_form():
3636
def register_guest():
3737
name = request.form.get('name')
3838
email = request.form.get('email')
39-
partysize = request.form.get('partysize')
40-
if not partysize or partysize=='':
41-
partysize = 1
4239

43-
guest = Guest(name, email, partysize)
40+
guest = Guest(name, email)
4441
DB.session.add(guest)
4542
DB.session.commit()
4643

4744
return render_template('guest_confirmation.html',
48-
name=name, email=email, partysize=partysize)
45+
name=name, email=email)
46+
47+

app/migrations/versions/32b48058cd02_.py

-28
This file was deleted.

app/models.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ class Guest(DB.Model):
77
id = DB.Column(DB.Integer, primary_key=True)
88
name = DB.Column(DB.String(80))
99
email = DB.Column(DB.String(120))
10-
partysize = DB.Column(DB.Integer, default=1)
1110

12-
def __init__(self, name=None, email=None, partysize=1):
11+
def __init__(self, name=None, email=None):
1312
self.name = name
14-
self.email = email
15-
self.partysize = partysize
16-
13+
self.email = email

app/templates/guest_confirmation.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
<h1>You are confirmed!</h1>
88
<p>
99
Name: {{ name }}<br/>
10-
Email: {{ email }}<br/>
11-
Number of attendees: {{ partysize }}
10+
Email: {{ email }}
1211
</p>
1312
<a href="/">View all attendees</a>
1413
{% endblock %}

app/templates/guest_list.html

-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ <h1>Registered Guests</h1>
1010
<tr>
1111
<th>Name</th>
1212
<th>Email</th>
13-
<th>Attendees</th>
1413
</tr>
1514
</thead>
1615
<tbody>
1716
{% for guest in guests %}
1817
<tr>
1918
<td>{{ guest.name }}</td>
2019
<td>{{ guest.email }}</td>
21-
<td>{% if guest.partysize %}{{ guest.partysize }}{% else %}1{% endif %}</td>
2220
</tr>
2321
{% endfor %}
2422
</table>

app/templates/guest_registration.html

-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ <h1>Guest Registration</h1>
1515
<label for="emailfield">Email address</label>
1616
<input type="email" class="form-control" id="emailfield" name="email" aria-describedby="emailHelp" placeholder="Email">
1717
<small id="emailHelp" class="form-text text-muted">Your email address in case we need to contact you.</small>
18-
</div>
19-
<div class="form-group">
20-
<label for="partyfield">Number of attendees</label>
21-
<input type="number" min="0" step="1" class="form-control" id="partyfield" name="partysize" aria-describedby="partyHelp" value="1">
22-
<small id="partyHelp" class="form-text text-muted"> Tell us how many people will be attending.</small>
2318
</div>
2419
<button type="submit" class="btn btn-default">Register</button>
2520
</form>

0 commit comments

Comments
 (0)