WIP - further work and refactoring

This commit is contained in:
collerek
2021-02-17 13:51:38 +01:00
parent 3fd231cf3c
commit 5d40fb6bff
7 changed files with 107 additions and 50 deletions

View File

@ -57,18 +57,18 @@ class PostCategory2(ormar.Model):
sort_order: int = ormar.Integer(nullable=True)
class Post2(ormar.Model):
class Meta(BaseMeta):
pass
id: int = ormar.Integer(primary_key=True)
title: str = ormar.String(max_length=200)
categories = ormar.ManyToMany(Category, through=ForwardRef("PostCategory2"))
@pytest.mark.asyncio
async def test_forward_ref_is_updated():
async with database:
class Post2(ormar.Model):
class Meta(BaseMeta):
pass
id: int = ormar.Integer(primary_key=True)
title: str = ormar.String(max_length=200)
categories = ormar.ManyToMany(Category, through=ForwardRef("PostCategory2"))
assert Post2.Meta.requires_ref_update
Post2.update_forward_refs()