Month: October 2018

Custom primary key format for Django models

When developing customer facing web applications usually you want to have some unique id for each object. By default django uses integer ID that is autoincremented by the database. However sometimes you want to expose this ID to your customer but you don’t want to expose how many objects of this type are there in your DB. Imagine case of e-commerce that want to show order number to customer but doesn’t want to reveal amount of orders to everyone in the world(especially competition). There are a few ways to accomplish that:

Continue reading