diff --git a/cps/db.py b/cps/db.py
index 704789b6..1e418593 100755
--- a/cps/db.py
+++ b/cps/db.py
@@ -11,7 +11,7 @@ from ub import config
import ub
session = None
-cc_exceptions = ['datetime', 'int', 'comments', 'float', 'composite', 'series']
+cc_exceptions = ['datetime', 'comments', 'float', 'composite', 'series']
cc_classes = None
engine = None
@@ -335,11 +335,18 @@ def setup_db():
primary_key=True)
)
cc_ids.append([row.id, row.datatype])
+ import sys
+ print >>sys.stderr,row.datatype
if row.datatype == 'bool':
ccdict = {'__tablename__': 'custom_column_' + str(row.id),
'id': Column(Integer, primary_key=True),
'book': Column(Integer, ForeignKey('books.id')),
'value': Column(Boolean)}
+ elif row.datatype == 'int':
+ ccdict = {'__tablename__': 'custom_column_' + str(row.id),
+ 'id': Column(Integer, primary_key=True),
+ 'book': Column(Integer, ForeignKey('books.id')),
+ 'value': Column(Integer)}
else:
ccdict = {'__tablename__': 'custom_column_' + str(row.id),
'id': Column(Integer, primary_key=True),
@@ -347,7 +354,7 @@ def setup_db():
cc_classes[row.id] = type('Custom_Column_' + str(row.id), (Base,), ccdict)
for cc_id in cc_ids:
- if cc_id[1] == 'bool':
+ if (cc_id[1] == 'bool') or (cc_id[1] == 'int'):
setattr(Books, 'custom_column_' + str(cc_id[0]), relationship(cc_classes[cc_id[0]],
primaryjoin=(
Books.id == cc_classes[cc_id[0]].book),
diff --git a/cps/templates/book_edit.html b/cps/templates/book_edit.html
index 5b44ac07..a24f74b5 100644
--- a/cps/templates/book_edit.html
+++ b/cps/templates/book_edit.html
@@ -51,12 +51,12 @@
-
+
-
+
{% if cc|length > 0 %}
{% for c in cc %}
@@ -68,6 +68,11 @@
{% endif %}
+
+ {% if c.datatype == 'int' %}
+
+ {% endif %}
+
{% if c.datatype in ['text', 'series'] and not c.is_multiple %}
0 %}
@@ -80,12 +85,12 @@
{% if book['custom_column_' ~ c.id]|length > 0 %}
value="{% for column in book['custom_column_' ~ c.id] %}{{ column.value.strip() }}{% if not loop.last %}, {% endif %}{% endfor %}"{% endif %}>
{% endif %}
-
+
{% if c.datatype == 'enumeration' %}
{% endfor %}
- {% endif %}
-
-
+ {% endif %}
+
+