diff --git a/apps/rss_feeds/models.py b/apps/rss_feeds/models.py index 2d20cf2d6..caabd77c3 100644 --- a/apps/rss_feeds/models.py +++ b/apps/rss_feeds/models.py @@ -1265,6 +1265,13 @@ class DuplicateFeed(models.Model): def __unicode__(self): return "%s: %s" % (self.feed, self.duplicate_address) + + def to_json(self): + return { + 'duplicate_address': self.duplicate_address, + 'duplicate_feed_id': self.duplicate_feed_id, + 'feed_id': self.feed.pk + } def merge_feeds(original_feed_id, duplicate_feed_id, force=False): from apps.reader.models import UserSubscription diff --git a/utils/json_functions.py b/utils/json_functions.py index 71021e70f..a1101e3a0 100644 --- a/utils/json_functions.py +++ b/utils/json_functions.py @@ -43,7 +43,9 @@ def json_encode(data, *args, **kwargs): # Opps, we used to check if it is of type list, but that fails # i.e. in the case of django.newforms.utils.ErrorList, which extends # the type "list". Oh man, that was a dumb mistake! - if isinstance(data, list): + if hasattr(data, 'to_json'): + ret = data.to_json() + elif isinstance(data, list): ret = _list(data) # Same as for lists above. elif isinstance(data, dict):