Я проверял этот код: https://code.djangoproject.com/ticket/11760#
но это не работает
class ClassA(models.Model):
pass
class AbstractClass(models.Model):
name = models.ManyToManyField(ClassA, related_name = '%(class)s_name', through = 'ClassA_%(class)s')
class Meta:
abstract = True
class MyClass(AbstractClass):
pass
class ClassA_MyClass(models.Model):
class_a=models.ForeignKey(ClassA, on_delete=models.CASCADE)
my_class=models.ForeignKey(MyClass, on_delete=models.CASCADE)
У меня есть эта ошибка:
(fields.E331) Field specifies a many-to-many relation through model 'ClassA_%(class)s', which has not been installed.