wilsaj / flask-admin-old

Deprecated Flask-Admin 0.x branch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make a difference between sequential and non-sequential primary keys

tooxie opened this issue · comments

Whenever you define a field as primary_key it won't appear in the add/edit form. This behaviour can be modified by setting the exclude_pks to False on admin.datastore.sqlalchemy.SQLAlchemyDatastore.

This is ok for autoincremental Integer fields, but when you need a String as a primary_key this becomes a problem. Usually string primary keys are not sequential, and need to be edited while keeping sequential database-defined keys hidden.

A possible solution would be to split the exclude_pks parameter into editable_pks and editable_sequential_pks. That way you can achieve the expected behaviour by setting editable_pks=True and editable_sequential_pks=False.