0

I am developing a Django app which includes some user profiles. (Profile is a custom model).

I want to implement the Profile in such a way so that I can access a page e.g localhost:8080/profile/234332 where 234332 is a random number.

I am not sure how to handle this unique identifier for each profile, shall I tried something like

id=models.CharField(max_length=100, blank=True, unique=True, default=uuid.uuid4)

This gives a way too long string but I wanted to be if possible a number of 5-8 digits. My concern is how to implement this field in such way so that will never be two profiles with the same ID.

Phrixus
  • 1,209
  • 2
  • 19
  • 36

0 Answers0