I am using DRF and have a couple models where I want to generate unique numbers separate from ID's. For example, one model would have a number like PRJ023400 and another would be TSK2949392.
I created a utility function to generate random numbers and as the field and attempted to use this function as the default.
number = models.CharField(max_length = 10,
blank=True,
editable=False,
default='PRJ'+create_new_ref_number())
The problem I am facing is that this only generates a new string when running a migration. What would be the best approach to make this work?
Cheers!