-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Union, tests and fixes #24
base: migration
Are you sure you want to change the base?
Conversation
graphene_django_pretty/types/base.py
Outdated
"""Base union type.""" | ||
|
||
class Meta: | ||
types = (None,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Наверное, стоит добавить проверку, что здесь лежат только DjangoObjectType в методе init_subclass_with_meta
@@ -191,7 +207,8 @@ def merge_model_and_interface_fields(cls, django_fields, interface_fields) -> Di | |||
for field_name, field_description in interface_fields.items(): | |||
# replace description from interface if it is not none. | |||
if field_description.description: | |||
merged_fields.get(field_name).description = field_description.description | |||
merged_fields.get( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можешь плз поправить везде переносы
tests/test_types/test_union.py
Outdated
from tests.django_setup.models import Article, Author, Post | ||
|
||
|
||
class PostType(DjangoObjectType): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут для тестов, наверное, лучше стоит использовать наш BaseDjangoObjectType
graphene_django_pretty/types/base.py
Outdated
@classmethod | ||
def resolve_type(cls, instance, info): | ||
"""Resolving grapql type by models instance.""" | ||
for type in cls._meta.types: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь бы переименовать на type_, чтобы не перезаписывать внутреннюю функцию python-а
graphene_django_pretty/types/base.py
Outdated
@@ -36,6 +35,21 @@ class PatchedDjangoObjectTypeOptions(ObjectTypeOptions): | |||
default_resolver = None | |||
|
|||
|
|||
class BaseUnion(graphene.Union): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут бы тоже переименовать, что это DjangoModelUnion
No description provided.