We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When field spans ManyToOneRel relationship, verbose_field_name returns '[invalid name]'.
ManyToOneRel
verbose_field_name
Here is how to reproduce it with models already included in most Django projects.
>>> from django_filters.utils import verbose_field_name ... from django.contrib.contenttypes.models import ContentType ... ... ContentType.objects.filter(permission__id=1) ... verbose_field_name(ContentType, "permission__id") '[invalid name]'
Reason is that part does not have related_name, when it is ManyToOneRel .
This is in https://github.com/carltongibson/django-filter/blob/main/django_filters/utils.py#L264
Function could check if part is instance and appent verbose name of related model, ie:
if isinstance(part, models.ManyToOneRel): names.append(force_str(part.related_model._meta.verbose_name)) elif isinstance(part, ForeignObjectRel):
I can create PR for this.
The text was updated successfully, but these errors were encountered:
As a beginner in open source, I understand the problem and would like to generate a pull request (PR) to address it.
Sorry, something went wrong.
Happy to look at a PR. Please include regression tests.
Successfully merging a pull request may close this issue.
When field spans
ManyToOneRel
relationship,verbose_field_name
returns '[invalid name]'.Here is how to reproduce it with models already included in most Django projects.
Reason is that part does not have related_name, when it is
ManyToOneRel
.This is in https://github.com/carltongibson/django-filter/blob/main/django_filters/utils.py#L264
Function could check if part is instance and appent verbose name of related model, ie:
I can create PR for this.
The text was updated successfully, but these errors were encountered: