I want to add a new HASH column to my existing django table. I referred How to generate HASH for Django model. Here is how I am doing it:
def _create_uuid():
return uuid.uuid4().hex[:20]
class users(models.Model):
user_id = models.CharField(max_length=100, primary_key=True)
uuid= models.CharField(max_length=20, null=False, default=_create_uuid)
While this works completely fine for all the new users created after the addition of the uuid column. But all the existing users get assigned with the same uuid in the uuid column when I migrate. I want the existing users to have unique uuid as well. How can I do this?
=_create_uuid()?