Fix missing related managers on some models (#902)

* Fix missing related managers on some models

I was seeing an issue where some related managers were missing from some
models. Traced the issue down to this line, where it appears that if we
hit a relation with a non-default(?) reverse manager the iteration
stopped. I _think_ this is supposed to be a continue statement instead.
It appears to work in the project I'm working in at least.

* Add test case

* Add test case
This commit is contained in:
Sigurd Ljødal
2022-03-31 22:36:22 +02:00
committed by GitHub
parent 49d855547b
commit 76e3fdb479
2 changed files with 90 additions and 1 deletions

View File

@@ -363,7 +363,7 @@ class AddRelatedManagers(ModelClassInitializer):
self.add_new_node_to_model_class(
attname, Instance(default_reverse_manager_info, []), no_serialize=True
)
return
continue
# The reverse manager we're looking for doesn't exist. So we create it.
# The (default) reverse manager type is built from a RelatedManager and the default manager on the related model