tortoise / aerich

A database migrations tool for TortoiseORM, ready to production.
https://github.com/tortoise/aerich
Apache License 2.0
823 stars 93 forks source link

backward relation "groups" duplicates in model User #114

Closed Chise1 closed 3 years ago

Chise1 commented 3 years ago

If model_name is a variable ,got an error. like this: ` class Group(models.Model): label = fields.CharField(max_length=50) users = fields.ManyToManyField(settings.AUTH_USER_MODEL) permissions = fields.ManyToManyField("models.Permission")

def __str__(self):
    return self.label

error: File "/home/chise/.cache/pypoetry/virtualenvs/fastapi-t-rYTP1qPO-py3.7/lib/python3.7/site-packages/tortoise/init.py", line 314, in _init_relations f'backward relation "{backward_relation_name}" duplicates in' tortoise.exceptions.ConfigurationError: backward relation "groups" duplicates in model User `

FalseDev commented 3 years ago

Your codeblocks are messed up, please fix them

alexanderankin commented 5 months ago
class Group(models.Model):
    label = fields.CharField(max_length=50)
    users = fields.ManyToManyField(settings.AUTH_USER_MODEL)
    permissions = fields.ManyToManyField("models.Permission")

    def __str__(self):
        return self.label
error: File "/home/chise/.cache/pypoetry/virtualenvs/fastapi-t-rYTP1qPO-py3.7/lib/python3.7/site-packages/tortoise/init.py", line 314, in _init_relations
f'backward relation "{backward_relation_name}" duplicates in'
tortoise.exceptions.ConfigurationError: backward relation "groups" duplicates in model User