Skip to content

Commit

Permalink
docs: admin_model_relations, fix dynamic_attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-boom authored and ChillarAnand committed Dec 8, 2021
1 parent 82c2d85 commit d890720
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion admin_model_relations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ We can write a custom admin class to dynamically set the methods as attributes s
def dynamic_attribute(obj):
for related_name in related_names:
obj = getattr(obj, related_name)
return obj
return obj
dynamic_attribute.admin_order_field = admin_order_field or name
dynamic_attribute.short_description = short_description or related_names[-1].title().replace('_', ' ')
Expand Down

0 comments on commit d890720

Please sign in to comment.