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

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -