Skip to content

Commit

Permalink
fix: fixed register_models: added skipping relations
Browse files Browse the repository at this point in the history
  • Loading branch information
MaksimZayats committed Sep 1, 2021
1 parent 0dfd23e commit 4ef7f0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion application/apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ class Meta:


def register_models() -> None:
Tortoise.init_models(models_paths=["apps.core.models"], app_label="core")
Tortoise.init_models(
models_paths=["apps.core.models"],
app_label="core",
_init_relations=False,
)
6 changes: 5 additions & 1 deletion application/config/app_template/models.py-tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ class ExampleModel(Model, ConvertedModel):


def register_models() -> None:
Tortoise.init_models(models_paths=["apps.{{ app_name }}.models"], app_label="{{ app_name }}")
Tortoise.init_models(
models_paths=["apps.{{ app_name }}.models"],
app_label="{{ app_name }}",
_init_relations=False,
)

0 comments on commit 4ef7f0c

Please sign in to comment.