I think there is a way to use something like GROUP BY inside your database query (by aggregating the results, for instance), but I don’t recall the right way of using it…
A COAGroup's ledges are available on the instance:
> group = COAGroup.objects.create()
> ledger = Ledger.objects.create(name="Fred", group=group)
> group.ledger_set # This is an iterable containing the ledgers for your group.
In your template you would have a double loop:
{% for group in groups %}
{{ group.name }}
{% for ledger in group.ledger_set %}
{{ ledger.name }}
{% endfor %}
{% endfor %}
I would strongly recommend going through the Django tutorial which covers this in the second part: all docs, part 2. You will learn a lot!
If you want to be more efficient you can use prefetch_related which will minimise the number of queries (by fetching all the groups and their associated ledgers up front rather than on demand):
groups = COAGroup.objects.prefetch_related("ledger").all()
Also, since you mentioned you’re a first time Python user I thought I’d mention Python naming conventions. Generally classes are written with CapitalsLikeThis (as you have done) while functions and attributes are_lowercase_and_have_underscores_between_words. These are pretty universally used in new Python code so might want to adopt these conventions too. RealPython has a good article on this.