formset, yes there is one - online edit of handbook/troggle/trogforms.html

This commit is contained in:
2025-02-21 17:23:41 +00:00
committed by Expo on server
parent ab10ab1ec4
commit d7b365611c

View File

@@ -9,7 +9,7 @@
<h4>Django Forms History</h4>
<p>Django has several generations of quite different clever mechanisms to make creating HTML forms "easier". Yes, making them might be easier, but maintaining this opinionated stuff is a nightmare without adequately educating yourself how the architecture works. This will take time: do not hurry.
<p>WARNING: when reading the Django documentation on <a href="https://docs.djangoproject.com/en/5.1/topics/forms/">Forms</a> (unbound and <a href="https://docs.djangoproject.com/en/5.1/ref/forms/api/">bound</a>) and <a href="https://docs.djangoproject.com/en/dev/topics/forms/modelforms/">ModelForms</a>, do not get diverted into looking at Formsets or ModelFormsets. We do not use any formsets in troggle - of any kind.
<p>WARNING: when reading the Django documentation on <a href="https://docs.djangoproject.com/en/5.1/topics/forms/">Forms</a> (unbound and <a href="https://docs.djangoproject.com/en/5.1/ref/forms/api/">bound</a>) and <a href="https://docs.djangoproject.com/en/dev/topics/forms/modelforms/">ModelForms</a>, do not get diverted into looking at Formsets or ModelFormsets. We do not use any formsets in troggle - of any kind[<a href="#bugger">*</a>].
<h3>Django 'Form' object</h3>
<ul>
@@ -30,7 +30,7 @@
<p>Hah, that was a nasty shock wasn't it? OK, most of that stuff is not the stuff which manages the data entry form. Concentrate on just the bits between the &lt;form&gt; ....&lt;/form&gt; tags.
<p>It might help you at this point to remind yourself how an ordinary webapge works, without a form. So look at <a href="/logbookentry/2024-08-01/2024-08-01c">a logbook entry</a> which just displays the data and the corresponding template <a href="/repositories/troggle/.git/tree/templates/logbookentry.html">logbookentry.html</a>... OK, not such a good idea: that is quite complicated. See <a href="#forloop">For loop</a> below.
<p>It might help you at this point to remind yourself how an ordinary webpage works, without a form. So look at <a href="/logbookentry/2024-08-01/2024-08-01c">a logbook entry</a> which just displays the data and the corresponding template <a href="/repositories/troggle/.git/tree/templates/logbookentry.html">logbookentry.html</a>... OK, not such a good idea: that is quite complicated. See <a href="#forloop">For loop</a> below.
<h4>HTML &lt;form&gt and fields</h4>
But if you haven't worked with HTML forms before, then you actually have <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form">a whole lot of HTML</a> you will need to learn from scratch: how the <code>&lt;form&gt; ....&lt;/form&gt; </code> tag works, and how fields and labels and stuff works, and "input" and "textarea" and "submit", and how tag attributes such as "disabled" or "required" work.
@@ -54,7 +54,8 @@ But if you haven't worked with HTML forms before, then you actually have <a href
<p>For the relationship between LogBookEntry and PersonLogEntry click on
<a href="../l/trogclass-1.html">the Class diagram</a> on the right.
<h4 id="bugger">Oh bugger</h4>
<p>Yes there is one FormSet, sorry. The joint Cave-and-Entrance thing.
<hr />
Go on to: <a href="trogdjangup.html">Troggle: updating Django</a><br />
Return to: <a href="trognotes.html">Troggle programmers' guide</a><br />