flask-admin-old
flask-admin-old copied to clipboard
Make a difference between sequential and non-sequential primary keys
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.