python - Peewee: change "Id" field with another name -
is there way on peewee model change default primary key named "id" name?
a couple ways...
auto-incrementing integer field named "pk":
class mymodel(model): pk = primarykeyfield() other_field = textfield()
varchar primary key:
class mymodel(model): data = charfield(primary_key=true)
multi-column primary key:
class mymodel(model): key = charfield() value = charfield() class meta: primary_key = compositekey('key', 'value')
Comments
Post a Comment