[django/django] 9cd520: Fixed #22994 -- regression with generic FK + admin...

1 view
Skip to first unread message

GitHub

unread,
Jul 14, 2014, 10:53:11 AM7/14/14
to django-...@googlegroups.com
Branch: refs/heads/master
Home: https://github.com/django/django
Commit: 9cd5201abd24ba2632753029ee1957947cdc32f5
https://github.com/django/django/commit/9cd5201abd24ba2632753029ee1957947cdc32f5
Author: Anssi Kääriäinen <akaa...@gmail.com>
Date: 2014-07-14 (Mon, 14 Jul 2014)

Changed paths:
M django/db/models/options.py
M tests/admin_views/admin.py
M tests/admin_views/tests.py
M tests/model_meta/test.py

Log Message:
-----------
Fixed #22994 -- regression with generic FK + admin list_view

The reason for the regression was that the GenericForeignKey field isn't
something meta.get_field_by_name() should return. The reason is that a
couple of places in Django expects get_field_by_name() to work this way.
It could make sense to return GFKs from get_field_by_name(), but that
should likely be done as part of meta refactoring or virtual fields
refactoring patches.

Thanks to glic...@gmail.com for the report and to Tim for working on
the issue.


Commit: efe87d3e48df9b7470a3006eeb7322f12b368fdf
https://github.com/django/django/commit/efe87d3e48df9b7470a3006eeb7322f12b368fdf
Author: Anssi Kääriäinen <akaa...@gmail.com>
Date: 2014-07-14 (Mon, 14 Jul 2014)

Changed paths:
M tests/generic_relations/tests.py

Log Message:
-----------
Fixed #22992 -- regression in .filter(generic_fk=...) error message

Generic Foreign Keys can't be used as lhs in lookups for historical
reasons. Django 1.6 gave a FieldDoesNotExist exception when using GFKs
as lhs in lookups, but due to regression caused by lookup refactor patch
(20bab2cf9d02a5c6477d8aac066a635986e0d3f3) the exception type was
changed to AttributeError.

It might be a good idea to add support for gfk__exact and gfk__in lookups
later on.

Thanks to glic...@gmail.com for the report. The code in this commit
was written by Tim Graham.


Compare: https://github.com/django/django/compare/38e001ab6caa...efe87d3e48df
Reply all
Reply to author
Forward
0 new messages