@@ -504,8 +504,7 @@ see if they start to make more sense as we use them more.
504
504
505
505
506
506
507
- Getting the FT a Little Further Along
508
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
507
+ ==== Getting the FT a Little Further Along
509
508
510
509
First let's get back to our FT and see where it's failing:
511
510
@@ -517,27 +516,23 @@ AssertionError: 'Check your email' not found in 'Superlists\nEnter email to log
517
516
in:\nStart a new To-Do list'
518
517
----
519
518
520
- Submitting the email address currently has no effect, because the form isn't
521
- sending the data anywhere. Let's wire it up in
522
- 'base.html':footnote:[I've split
523
- the form tag across three lines so it fits nicely in the book. If
524
- you've not seen it before, it may look a little weird to you, but it is valid
525
- HTML. You don't have to use it if you don't like it though. :)]
526
-
519
+ Submitting the email address currently has no effect,
520
+ because the form isn't sending the data anywhere.
521
+ Let's wire it up in _base.html_:
527
522
528
523
[role="sourcecode small-code"]
529
524
.src/lists/templates/base.html (ch19l012)
530
525
====
531
526
[source,html]
532
527
----
533
- <form class="navbar-form navbar-right"
534
- method="POST"
535
- action="{% url 'send_login_email' %}">
528
+ <form method="POST" action="{% url 'send_login_email' %}">
536
529
----
537
530
====
538
531
539
- Does that help? Nope, same error. Why? Because we're not actually displaying
540
- a success message after we send the user an email. Let's add a test for that.
532
+ Does that help? Nope, same error. Why?
533
+ Because we're not actually displaying a success message
534
+ after we send the user an email.
535
+ Let's add a test for that.
541
536
542
537
543
538
==== Testing the Django Messages Framework
@@ -1850,16 +1845,24 @@ and non–logged-in users (which our FT relies on):
1850
1845
<div class="container-fluid">
1851
1846
<a class="navbar-brand" href="/">Superlists</a>
1852
1847
{% if user.email %}
1853
- <!-- TODO put in a ul -->
1854
- <span class="navbar-text">Logged in as {{ user.email }}</span>
1855
- <a href="#">Log out</a>
1848
+ <ul>
1849
+ <span class="navbar-text">Logged in as {{ user.email }}</span>
1850
+ <a href="{% url 'logout' %}">Log out</a>
1851
+ </ul>
1856
1852
{% else %}
1857
- <form class="navbar-form navbar-right"
1858
- method="POST"
1859
- action="{% url 'send_login_email' %}">
1860
- <span>Enter email to log in:</span>
1861
- <input class="form-control" name="email" type="text" />
1862
- {% csrf_token %}
1853
+ <form method="POST" action="{% url 'send_login_email' %}">
1854
+ <div class="input-group">
1855
+ <label class="navbar-text me-2" for="id_email_input">
1856
+ Enter your email to log in
1857
+ </label>
1858
+ <input
1859
+ id="id_email_input"
1860
+ name="email"
1861
+ class="form-control"
1862
+
1863
+ />
1864
+ {% csrf_token %}
1865
+ </div>
1863
1866
</form>
1864
1867
{% endif %}
1865
1868
</div>
0 commit comments