1
0
mirror of https://github.com/django/django.git synced 2025-10-25 06:36:07 +00:00

Fixed #21431 -- GenRel->FK list_filter regression in admin

Report, analysis and tests from stephenmcd.
This commit is contained in:
Anssi Kääriäinen
2013-11-21 14:11:57 +02:00
parent 1116a5662c
commit 752d3d70da
2 changed files with 20 additions and 4 deletions

View File

@@ -389,10 +389,8 @@ class NotRelationField(Exception):
def get_model_from_relation(field):
if isinstance(field, models.related.RelatedObject):
return field.model
elif getattr(field, 'rel'): # or isinstance?
return field.rel.to
if hasattr(field, 'get_path_info'):
return field.get_path_info()[-1].to_opts.model
else:
raise NotRelationField