stop setting sort to false by default on relation field and explain why 3.5
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 16 Sep 2009 14:33:24 +0200
branch3.5
changeset 3246 9e4adca73a95
parent 3245 7ef021ac8dec
child 3247 a6243d9585ba
stop setting sort to false by default on relation field and explain why
web/formfields.py
--- a/web/formfields.py	Wed Sep 16 14:32:56 2009 +0200
+++ b/web/formfields.py	Wed Sep 16 14:33:24 2009 +0200
@@ -438,9 +438,16 @@
 
 
 class RelationField(Field):
-    def __init__(self, **kwargs):
-        kwargs.setdefault('sort', False)
-        super(RelationField, self).__init__(**kwargs)
+    # XXX (syt): iirc, we originaly don't sort relation vocabulary since we want
+    # to let entity.unrelated_rql control this, usually to get most recently
+    # modified entities in the select box instead of by alphabetical order. Now,
+    # we first use unrelated_rql to get the vocabulary, which may be limited
+    # (hence we get the latest modified entities) and we can sort here for
+    # better readability
+    #
+    # def __init__(self, **kwargs):
+    #     kwargs.setdefault('sort', False)
+    #     super(RelationField, self).__init__(**kwargs)
 
     @staticmethod
     def fromcardinality(card, **kwargs):