I've got a model that looks something like this
class SecretKey(Model):
user = ForeignKey('User', related_name='secret_keys')
created = DateTimeField(auto_now_add=True)
updated = DateTimeField(auto_now=True)
key = CharField(max_length=16, default=randstr(length=16))
purpose = PositiveIntegerField(choices=SecretKeyPurposes)
expiry_date = DateTimeField(default=datetime.datetime.now()+datetime.timedelta(days=7), null=True, blank=True)
You'll notice that the default value for key
is a random 16-character string. Problem is, I think this value is getting cached and being used several times in a row. Is there any way I can get a different string every time? (I don't care about uniqueness/collisions)