-
Notifications
You must be signed in to change notification settings - Fork 771
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
verbose_field_name can break on manytomany relationships #716
Comments
@JamesRamm Yep. Seems reasonable. If you put together a test case and patch I'll push a new release with that. |
This is ref #686 and |
@JamesRamm - can you give a simple example of the models. Would this be related to |
Also, |
I think this may be to do with use of a 'through' model on an m2m, but I cannot be 100% sure - still working toward a smallest possible scenario to repeat it. |
I have this when reversing a |
I can confirm this bug. I'm not sure which model in my application is causing it, but I've had to revert to 1.0.2 for now. |
@AGASS007 Anyway, ending up with
I agree it may not be desired behaviour although I think it should be handled since it is a valid situation. I guess an ideal solution would be to somehow fallback on some name based on the ForeignKey model? (class.name or something?) |
I'll take a quick patch with test over the perfect solution for this. |
Right, has anyone got a reproduce for me? |
#722 provides a test an workaround for this. Can you give it a run and confirm it resolves your issue. (We can come back for v1.1 to improve behaviour.) Bonus points if you can explain the failing test case behaviour. |
#722 solves our issue. Nice! |
* Failing test for #716 * Handle case where related_name is None
https://github.com/carltongibson/django-filter/releases/tag/1.0.4 is now available. |
Some change between 1.0.2 and 1.0.3 has meant
verbose_field_name
can now raise anAttributeError
in cases where therelated_name
on aManyToManyRel
isNone
, which can happen.Specifically this line:
names.append(part.related_name.replace('_', ' '))
I suggest changing it to something like:
which is what you wouldve got from 1.0.2
The text was updated successfully, but these errors were encountered: