79645947

Date: 2025-05-30 18:46:12
Score: 1
Natty:
Report link
`id = models.CharField(max_length=10, unique=True, editable=False)`
` def save(self, *args, **kwargs):
        if not self.id:
            self.id = get_random_string(6).upper()
        super().save(*args, **kwargs)`

You can make it simple through just overriding the default save method of models

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: M Junaid