How do you reference a model name in a Django model mixin field definition?
Advertisements How do you reference the model name in field definition in a model mixin? Ie, what would replace model_name here: class CreatedByMixin(models.Model): class Meta: abstract = True created_by = ForeignKey( User, verbose_name="Created by", help_text="User that created the record", related_name=f"{model_name}_created", editable=False, ) Such that the related name on this model is ‘MyModel_created’? class MyModel(UserAuditMixin, TimeStampedModel):… Read More How do you reference a model name in a Django model mixin field definition?