@@ -178,9 +178,11 @@ NOTE: Doing this sort of widget customisation would get tedious
178
178
if we had a much larger, more complex form.
179
179
Check out
180
180
https://django-crispy-forms.readthedocs.org/[django-crispy-forms]
181
- and http://bit.ly/1rR5eyD[django-floppyforms] for some help.
182
181
((("django-crispy-forms")))
183
- ((("django-floppyforms")))
182
+ //CSANAD: crispy forms still seems to be maintained and up-to-date, floppyforms
183
+ // not so much. Some comments on floppyforms' issues say that its
184
+ // functionality is built into Django as of 2020. I'm not sure if it's true for
185
+ // crispyforms as well.
184
186
185
187
186
188
[role="pagebreak-before less_space"]
@@ -535,8 +537,9 @@ the logic change:
535
537
[subs="specialcharacters,quotes"]
536
538
----
537
539
$ *git diff* # review changes in base.html, views.py and its tests
538
- $ *git commit -am "use new form in home_page, simplify tests . NB breaks stuff"*
540
+ $ *git commit -am "use new form in home_page. NB breaks stuff"*
539
541
----
542
+ // CSANAD: we didn't simplify the tests in this step. What's NB?
540
543
541
544
542
545
Let's fix the functional tests.
@@ -613,6 +616,8 @@ $ *grep -r id_new_item src/lists/*
613
616
----
614
617
615
618
Good, there are no references to `id_new_item` left.
619
+ // CSANAD: we could mention *.pyc files under __pycache__ would probably still
620
+ // show up in the results.
616
621
What about `name`/ `item_text`?
617
622
618
623
[subs="specialcharacters,macros"]
@@ -645,33 +650,32 @@ Ran 17 tests in 0.126s
645
650
OK
646
651
----
647
652
648
- And the functional tests too:
653
+ And the functional tests too, where we can see three errors :
649
654
650
- [subs="specialcharacters,macros"]
651
655
----
652
- $ pass:quotes[*python src/manage.py test functional_tests*]
656
+ ERROR: test_layout_and_styling ( functional_tests.test_layout_and_styling.LayoutAndStylingTest.test_layout_and_styling)
653
657
[...]
654
- File "...goat-book/src/functional_tests/test_layout_and_styling.py", line 27,
655
- in test_layout_and_styling
656
- inputbox = self.get_item_input_box()
657
- ^^^^^^^^^^^^^^^^^^^^^^^^^
658
- File "...goat-book/src/functional_tests/base.py", line 45, in
659
- get_item_input_box
660
- return self.browser.find_element(By.ID, "id_text")
661
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
658
+ selenium.common.exceptions.NoSuchElementException: Message: Unable to locate
659
+ element: [id="id_text"];
660
+ [...]
661
+ ERROR: test_can_start_a_todo_list (functional_tests.test_simple_list_creation.NewVisitorTest.test_can_start_a_todo_list)
662
662
[...]
663
663
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate
664
- element: [id="id_text"]; [...]
665
-
664
+ element: [id="id_text"];
666
665
[...]
667
- FAILED (errors=3)
668
666
----
669
667
670
- Not quite! Let's look at where this is happening--if
671
- you check the line number from one of the failures,
672
- you'll see that each time after we've submitted a first item,
673
- the input box has disappeared from the lists page.
668
+ and
674
669
670
+ ----
671
+ ERROR: test_cannot_add_empty_list_items (functional_tests.test_list_item_validation.ItemValidationTest.test_cannot_add_empty_list_items)
672
+ [...]
673
+ selenium.common.exceptions.NoSuchElementException: Message: Unable to locate
674
+ element: .invalid-feedback;
675
+ [...]
676
+ ----
677
+
678
+ Let's start with the latter.
675
679
Checking _views.py_ and the `new_list` view we can see
676
680
it's because if we detect a validation error,
677
681
we're not actually passing the form to the _home.html_ template:
@@ -1030,8 +1034,6 @@ or spin up the site manually with `manage.py runserver` if you prefer
1030
1034
(see <<html5_popup_screenshot>>).
1031
1035
1032
1036
1033
- // todo: update screenshot
1034
-
1035
1037
[[html5_popup_screenshot]]
1036
1038
.HTML5 validation says no
1037
1039
image::images/twp2_1401.png["The input with a popup saying 'please fill out this field'"]
0 commit comments