some enhancements: link to relation/target type, remove to be deprecated meta, one table for subject relations, another for object relations stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 02 Jul 2009 10:20:34 +0200
branchstable
changeset 2228 7e85d0169911
parent 2227 21c9b63a4730
child 2229 edf20a9ca376
some enhancements: link to relation/target type, remove to be deprecated meta, one table for subject relations, another for object relations
web/views/schema.py
--- a/web/views/schema.py	Thu Jul 02 10:19:41 2009 +0200
+++ b/web/views/schema.py	Thu Jul 02 10:20:34 2009 +0200
@@ -42,6 +42,7 @@
                % (entity.dc_type().capitalize(),
                   html_escape(entity.dc_long_title())))
 
+
 # CWEType ######################################################################
 
 class CWETypeOneLineView(baseviews.OneLineView):
@@ -93,25 +94,22 @@
                                 {'x': entity.eid})
         self.wview('editable-table', rset, 'null', displayfilter=True)
         self.w(u'<h2>%s</h2>' % _('Relations'))
-        rset = self.req.execute('Any N,C,F,M,K,D,A ORDERBY N '
-                                'WITH N,C,F,M,D,K,A BEING ('
-                                '(Any N,C,F,M,K,D,A '
-                                'ORDERBY N WHERE A is CWRelation, '
-                                'A description D, A composite K?, '
-                                'A relation_type R, R name N, '
-                                'A to_entity O, O name F, '
-                                'A cardinality C, O meta M, '
-                                'A from_entity S, S eid %(x)s)'
-                                ' UNION '
-                                '(Any N,C,F,M,K,D,A '
-                                'ORDERBY N WHERE A is CWRelation, '
-                                'A description D, A composite K?, '
-                                'A relation_type R, R name N, '
-                                'A from_entity S, S name F, '
-                                'A cardinality C, S meta M, '
-                                'A to_entity O, O eid %(x)s))'
-                                ,{'x': entity.eid})
-        self.wview('editable-table', rset, 'null', displayfilter=True)
+        rset = self.req.execute(
+            'Any R,C,TT,K,D,A,RN,TTN ORDERBY RN '
+            'WHERE A is CWRelation, A description D, A composite K?, '
+            'A relation_type R, R name RN, A to_entity TT, TT name TTN, '
+            'A cardinality C, A from_entity S, S eid %(x)s',
+            {'x': entity.eid})
+        self.wview('editable-table', rset, 'null', displayfilter=True,
+                   displaycols=range(6), mainindex=5)
+        rset = self.req.execute(
+            'Any R,C,TT,K,D,A,RN,TTN ORDERBY RN '
+            'WHERE A is CWRelation, A description D, A composite K?, '
+            'A relation_type R, R name RN, A from_entity TT, TT name TTN, '
+            'A cardinality C, A to_entity O, O eid %(x)s',
+            {'x': entity.eid})
+        self.wview('editable-table', rset, 'null', displayfilter=True,
+                   displaycols=range(6), mainindex=5)
 
 
 class CWETypeSImageView(EntityView):