widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #10681
[Merge] lp:~widelands-dev/widelands-website/fix_wares_for_encyclopedia into lp:widelands-website
kaputtnik has proposed merging lp:~widelands-dev/widelands-website/fix_wares_for_encyclopedia into lp:widelands-website.
Commit message:
Fix wares oredring in encyclopedia by ordering of wares.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1704955 in Widelands Website: "Buidcost in buildings ovewview is not updated correctly"
https://bugs.launchpad.net/widelands-website/+bug/1704955
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/fix_wares_for_encyclopedia/+merge/327737
This fixes bug 1704955 by sorting a dict and provide a default ordering when querying a ware.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/fix_wares_for_encyclopedia into lp:widelands-website.
=== modified file 'wlhelp/management/commands/update_help.py'
--- wlhelp/management/commands/update_help.py 2016-07-02 12:38:06 +0000
+++ wlhelp/management/commands/update_help.py 2017-07-19 18:27:52 +0000
@@ -24,6 +24,7 @@
import re
import json
import subprocess
+import collections
from settings import MEDIA_ROOT, WIDELANDS_SVN_DIR, MEDIA_URL
@@ -209,6 +210,7 @@
element_set = {}
for element in json_:
element_set[element['name']] = str(element['amount'])
+ element_set = collections.OrderedDict(sorted(element_set.items()))
counts = ' '.join(element_set.values())
objects = [objtype.objects.get_or_create(name=w, tribe=self._to)[
0] for w in element_set.keys()]
=== modified file 'wlhelp/models.py'
--- wlhelp/models.py 2016-07-02 12:38:06 +0000
+++ wlhelp/models.py 2017-07-19 18:27:52 +0000
@@ -55,6 +55,9 @@
# This limit shall probably cover the longest help (found 209, nothing
# more)
help = models.TextField(max_length=256)
+
+ class Meta:
+ ordering = ['name']
if settings.USE_SPHINX:
search = SphinxSearch(
Follow ups