[Answered ]-How does Django generates uuid?

1👍

You’re using uuid.uuid1, which as the docs state:

Generate a UUID from a host ID, sequence number, and the current time.

You should be using uuid.uuid4, which generates a random uuid.

1👍

It uses uuid.uuid1 to do it (that’s your default value). See the docs:

Generate a UUID from a host ID, sequence number, and the current time.
If node is not given, getnode() is used to obtain the hardware
address. If clock_seq is given, it is used as the sequence number;
otherwise a random 14-bit sequence number is chosen.

There are other algorithms, maybe uuid4 is what you are looking for.

Leave a comment