_set - online edit of handbook/troggle/trogforms.html

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

View File

@@ -50,7 +50,7 @@ But if you haven't worked with HTML forms before, then you actually have <a href
[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.
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 <a href="https://dnmtechs.com/understanding-the-_set-attribute-in-django-querysets/"><em>function</em> "_set"</a> 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.