Commits

Anonymous committed 5a222f0 Merge

[wdmmg][merge]: Trivial merge.

Comments (0)

Files changed (3)

wdmmg/wdmmg/controllers/key.py

         c.row = (model.Session.query(model.Key)
             .filter_by(id=id_)
             ).one()
+        c.num_accounts = (model.Session.query(model.KeyValue)
+            .filter_by(key=c.row)
+            .filter_by(ns='account')
+            ).count()
         query = model.Session.query(model.EnumerationValue).filter_by(key_id=c.row.id)
         c.page = Page(
             collection=query,

wdmmg/wdmmg/model/__init__.py

         self.init_db()
     
     def delete_all(self):
-        for obj in [ Posting, Transaction, Account, Slice, KeyValue, Key, 
-            EnumerationValue]:
+        for obj in [ Posting, Transaction, Account, Slice, KeyValue, 
+            EnumerationValue,  Key]:
             Session.query(obj).delete()
         Session.commit()
         Session.remove()

wdmmg/wdmmg/templates/key/view.html

   <div py:def="content">
     <p>Properties of key '${c.row.name}':</p>
     <dl>
+      <dt>Usage (number of accounts):</dt>
+      <dd>
+        <a href="${url(controller='key', action='accounts', id_=c.row.id)}">${c.num_accounts}</a>
+      </dd>
+      
+      <py:if test="c.row.notes">
+        <dt>Notes:</dt>
+        <dd>${c.row.notes}</dd> <!-- TODO: Markdown -->
+      </py:if>
     
       <dt>Values with defined meanings:</dt>
       <dd py:if="not c.row.enumeration_values"><em>(None)</em></dd>
           </li>
         </ul>
       </dd>
-      
-      <py:if test="c.row.notes">
-        <dt>Notes:</dt>
-        <dd>${c.row.notes}</dd> <!-- TODO: Markdown -->
-      </py:if>
     </dl>
   </div>