I am developing a web application using google appengine and django, but I think my problem is more general.
Users have the ability to create tables, look: tables are not presented as TABLES in the database. I will give you an example:
First form:
Name of the the table: __________
First column name: __________
Second column name: _________
...
The number of columns is not fixed, but there is a maximum (for example, 100). The type in each column is the same.
Second form (after choosing a particular table the user can fill the table):
column_name1: _____________
column_name2: _____________
....
I am using this solution, but it is wrong:
class Table(db.Model):
name = db.StringProperty(required = True)
class Column(db.Model):
name = db.StringProperty(required = True)
number = db.IntegerProperty()
table = db.ReferenceProperty(table, collection_name="columns")
class Value(db.Model):
time = db.TimeProperty()
column = db.ReferenceProperty(Column, collection_name="values")
when I want to list a table, I take its columns and from each column I take their values:
data = []
for column in data.columns:
column_data = []
for value in column.values:
column_data.append(value.time)
data.append(column_data)
data = zip(*data)
, - , , . ( ):
Table as I want: as I will got:
a z c a e c
d e f d h f
g h i g z i
? , ListProperty?