class diagram - online edit of handbook/troggle/trogforms.html

This commit is contained in:
Philip Sargent at home 2024-12-31 07:09:17 +00:00 committed by Expo on server
parent b6c44f4aca
commit cbdf3c7052

View File

@ -42,11 +42,17 @@ But if you haven't worked with HTML forms before, then you actually have <a href
<h3>ModelForms</h3>
<p>A few of our data entry pages use <a href="https://docs.djangoproject.com/en/5.1/topics/forms/modelforms/">ModelForms</a>, these are where the Form object is automagically created from a Model class. If you can't find where something is initialised, it is probably because it was done automatically and invisibly by instantiating a ModelForm.
<h3 id="forloop">For loop</h3> _
<h3 id="forloop">For loop</h3>
<figure class="onright">
<a href="../l/trogclass-1.html"><img src="../t/trogclass-2.jpg" ></a>
<br><figcaption>Class Diagram<br />(Click to enlarge)</figcaption>
</figure>_
[This section to be moved to a generic Django Templating page]
<p> In <a href="/repositories/troggle/.git/tree/templates/logbookentry.html">logbookentry.html</a> you will see the Django template code
<code>{% for personlogentry in logbookentry.personlogentry_set.all %}</code>
which illustrates the for loop syntax, but also the my_object.attribute syntax, where the attribute is a one-to-many link to other Objects (instances of a Class) and has the <em>function</em> "_set" applied followed by the <a href="https://docs.djangoproject.com/en/5.1/ref/models/querysets/#django.db.models.query.QuerySet.all">QuerySet function</a> ".all". The effect of the for loop is to iterate through all the "personlogentry" instances referenced by the specific "logbookentry" the page is looking at.
<p>For the relationship between LogBookEntry and PersonLogEntry click on
<a href="../l/trogclass-1.html">the Class diagram</a> on the right.
<hr />