Skip to content

Commit

Permalink
Merge pull request #309 from ellmetha/master
Browse files Browse the repository at this point in the history
Fixed translatable fields discovery with the new _meta API and generic relations
  • Loading branch information
deschler committed May 6, 2015
2 parents 9c7ac4e + 54883a1 commit 3a9fc92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modeltranslation/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ def get_fields_to_translatable_models(model):
results = []
if NEW_META_API:
for f in model._meta.get_fields():
if f.is_relation:
if f.is_relation and f.related_model:
# The new get_field() will find GenericForeignKey relations.
# In that case the 'related_model' attribute is set to None
# so it is necessary to check for this value before trying to
# get translatable fields.
if get_translatable_fields_for_model(f.related_model) is not None:
results.append((f.name, f.related_model))
else:
Expand Down

0 comments on commit 3a9fc92

Please sign in to comment.