Commit 551aad3c authored by Serge S. Koval's avatar Serge S. Koval

Merge pull request #162 from jurka/master

Fixed primary key field detection for peewee
parents d291c236 b9c153d3
...@@ -3,7 +3,7 @@ from peewee import PrimaryKeyField ...@@ -3,7 +3,7 @@ from peewee import PrimaryKeyField
def get_primary_key(model): def get_primary_key(model):
for n, f in model._meta.get_sorted_fields(): for n, f in model._meta.get_sorted_fields():
if type(f) == PrimaryKeyField: if type(f) == PrimaryKeyField or f.primary_key:
return n return n
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment