class MyModel(models.Model):
    prefix = models.CharField(max_length=3)
slug = models.SlugField(max_length=255)
name = models.CharField(max_length=255)


class Meta:
    unique_together = 'prefix', 'slug'
Django: how to do get_or_create() in a threadsafe way?