If I have a model with a field declared (note upper case "ID"):
id = db.Column('ID', db.Integer, primary_key=True)
And an associated ModelForm with a field:
id = IntegerField()
When I post back the form (unchanged, for testing), it tries to recreate the row because it's not matching up to the existing row here:
|
data_val = data.get(col.name) |
Because the field is 'id' and the Column was initialized upper case as 'ID' (Of course I can make it lower case in this situation and it works)
So I'm just learning alchemy & wtforms - but this seems to rely on an unspoken naming convention (or at least consistency through the stack) - naming the PK field the same as the db column. This is not otherwise a requirement and took me a bit to figure out what was happening.
So my question is, can/should this be looking at the names of the fields instead of the internal column name? Or is this by design and I'm just missing something.
If I have a model with a field declared (note upper case "ID"):
id = db.Column('ID', db.Integer, primary_key=True)
And an associated ModelForm with a field:
id = IntegerField()
When I post back the form (unchanged, for testing), it tries to recreate the row because it's not matching up to the existing row here:
wtforms-alchemy/wtforms_alchemy/utils.py
Line 105 in d619202
Because the field is 'id' and the Column was initialized upper case as 'ID' (Of course I can make it lower case in this situation and it works)
So I'm just learning alchemy & wtforms - but this seems to rely on an unspoken naming convention (or at least consistency through the stack) - naming the PK field the same as the db column. This is not otherwise a requirement and took me a bit to figure out what was happening.
So my question is, can/should this be looking at the names of the fields instead of the internal column name? Or is this by design and I'm just missing something.