1. Olemis Lang
  2. bloodhound-mq

Source

bloodhound-mq / t333 / t333_r1427886_schema_autoinc.diff

The branch 't115_product_env' does not exist.
# HG changeset patch
# Parent d143652322b7ec13c6bd1f0b7aaf7fa01297ba6a
BH Dashboard #333 : Consider auto_increment when generating schema from model metadata

diff -r d143652322b7 bloodhound_dashboard/bhdashboard/model.py
--- a/bloodhound_dashboard/bhdashboard/model.py	Wed Jan 02 18:06:37 2013 +0000
+++ b/bloodhound_dashboard/bhdashboard/model.py	Thu Jan 03 00:51:31 2013 -0500
@@ -232,7 +232,9 @@
     
     @classmethod
     def _get_schema(cls):
-        fields =  [Column(field) for field in cls._get_fields()]
+        fields =  [Column(field, \
+                        auto_increment=field in cls._meta.get('auto_inc', [])) \
+                for field in cls._get_fields()]
         return Table(cls._meta['table_name'], key=set(cls._meta['key_fields'] +
                             cls._meta['unique_fields'])) [fields]
 
diff -r d143652322b7 bloodhound_multiproduct/tests/model.py
--- a/bloodhound_multiproduct/tests/model.py	Wed Jan 02 18:06:37 2013 +0000
+++ b/bloodhound_multiproduct/tests/model.py	Thu Jan 03 00:51:31 2013 -0500
@@ -159,6 +159,6 @@
         product.description = new_description
         self.assertEqual(new_description, product.description)
 
-if __name__ == '__main_':
+if __name__ == '__main__':
     unittest.main()