Hello,
I would like to share this small package adding a useful field to Django.
It adds a simple model field taking it’s value from a postgres sequence. This is an easy replacement for django autofield offering the following advantages:
-
Sequence could be shared among multiple models (db tables), so you can now have unique id among multiple django models
-
Possibility to generate alphanumeric id of the form “{PREFIX}_{ID}”
-
Unique Id could also be combined with data from other field to build complex id. One example is given that combine unique id with date information to offer an efficient table indexing/clustering for faster data retrieval when filtering on date. (Particularly useful with BRIN index)
Have a look at it and see example use cases in the doc:
Feedbacks and comments are welcome,
A star on GitHub is always appreciated if you believe this work deserve it
Loïc