I want a unique field generated at database level. The way unique=True works is it raises an error if it see’s a duplicate value in the database. I don’t want that though, I want it to simply generate a new unique number instead of raising an error.
This is the model that gives a user an account number, Any help will be much appreciated
class Account(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
account_number = ShortUUIDField(unique=True,length=10, max_length=25, prefix="217", alphabet="1234567890")