Skip to content

Instantly share code, notes, and snippets.

@loic
Created May 1, 2014 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loic/11458982 to your computer and use it in GitHub Desktop.
Save loic/11458982 to your computer and use it in GitHub Desktop.
diff --git a/mezzanine/generic/fields.py b/mezzanine/generic/fields.py
index 8d8dd94..e95de37 100644
--- a/mezzanine/generic/fields.py
+++ b/mezzanine/generic/fields.py
@@ -134,6 +134,12 @@ class BaseGenericRelation(GenericRelation):
"""
pass
+ def value_from_object(self, obj):
+ """
+ Returns the value of this field in the given model instance.
+ """
+ return getattr(obj, self.attname).all()
+
class CommentsField(BaseGenericRelation):
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment