Skip to content
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

Support Generated Field - Django 5 #123

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions djangoql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
from .exceptions import DjangoQLSchemaError


try:
from django.db.models.fields.generated import \
GeneratedField # Django >= 5.0
except ImportError:
GeneratedField = None


class DjangoQLField(object):
"""
Abstract searchable field
Expand Down Expand Up @@ -417,6 +424,8 @@ def get_field_instance(self, model, field_name):
return field_cls(**field_kwargs)

def get_field_cls(self, field):
if GeneratedField and isinstance(field, GeneratedField):
field = field.output_field
str_fields = (
models.CharField,
models.TextField,
Expand Down
Loading