如何按字母顺序将此Django模板代码的输出排序?

问题描述

| 我在Django模板中有以下代码:
{% for object in object_list %}
{% with game=object.game %}

<a href=\"{% url game_view game.id game.title|slugify %}\" class=\"img_link alphabeticList\">{{game.title}}</a>

{% endwith %}
{% endfor %}
它输出当前类别中的所有游戏,例如:
Armor Dude
Midnight Strike
Super Mafia Bros
Mission To Mars
Zed
game1 test 3
Examine the mystery of the crime in Apartment 13
Manor Freedom : The Patron\'s Chamber
Escape Journey
Outrun Summer Camp
Make your way through zombies hordes
Intelligent Guy
Run 3D : The Bathroom
Lady Gaga Escape Game
Insane Box
Will you do me A Small Favor?
Shanty Breakout
Cloudy Tumble Second Chaptert
Hotel Area Lock In
Escape From the Aircraft Hangar
RANDOM GAMES
Scene of the Caper: Gold Toy Scene of the Caper: ...    
Escape Journey Escape Journey
Cloudy Tumble Second Chaptert Cloudy Tumble Second...   
Midnight Strike Midnight Strike
BB EXCLUSIVES
Soldier Of Pain Soldier Of Pain     
Walk The Stork Walk The Stork
如何获得按字母顺序排列并在每个游戏标题开头的字母下方的输出,例如:
A
---

Apple
Alligator

B
---

Burger
Bungee
Bear

C
---

cat
等等... 请注意,我只能使用模板标签,而无权访问任何python代码。     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)