{"action":"created","issue":{"url":"https://api.github.com/repos/torchbox/wagtail/issues/1745","labels_url":"https://api.github.com/repos/torchbox/wagtail/issues/1745/labels{/name}","comments_url":"https://api.github.com/repos/torchbox/wagtail/issues/1745/comments","events_url":"https://api.github.com/repos/torchbox/wagtail/issues/1745/events","html_url":"https://github.com/torchbox/wagtail/issues/1745","id":108625291,"number":1745,"title":"MultipleObjectsReturned: get() returned more than one Embed","user":{"login":"lee-kagiso","id":11830393,"avatar_url":"https://avatars.githubusercontent.com/u/11830393?v=3","gravatar_id":"","url":"https://api.github.com/users/lee-kagiso","html_url":"https://github.com/lee-kagiso","followers_url":"https://api.github.com/users/lee-kagiso/followers","following_url":"https://api.github.com/users/lee-kagiso/following{/other_user}","gists_url":"https://api.github.com/users/lee-kagiso/gists{/gist_id}","starred_url":"https://api.github.com/users/lee-kagiso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lee-kagiso/subscriptions","organizations_url":"https://api.github.com/users/lee-kagiso/orgs","repos_url":"https://api.github.com/users/lee-kagiso/repos","events_url":"https://api.github.com/users/lee-kagiso/events{/privacy}","received_events_url":"https://api.github.com/users/lee-kagiso/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/torchbox/wagtail/labels/Bug","name":"Bug","color":"ff0000"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/torchbox/wagtail/milestones/18","html_url":"https://github.com/torchbox/wagtail/milestones/1.2","labels_url":"https://api.github.com/repos/torchbox/wagtail/milestones/18/labels","id":1277884,"number":18,"title":"1.2","description":"","creator":{"login":"gasman","id":85097,"avatar_url":"https://avatars.githubusercontent.com/u/85097?v=3","gravatar_id":"","url":"https://api.github.com/users/gasman","html_url":"https://github.com/gasman","followers_url":"https://api.github.com/users/gasman/followers","following_url":"https://api.github.com/users/gasman/following{/other_user}","gists_url":"https://api.github.com/users/gasman/gists{/gist_id}","starred_url":"https://api.github.com/users/gasman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gasman/subscriptions","organizations_url":"https://api.github.com/users/gasman/orgs","repos_url":"https://api.github.com/users/gasman/repos","events_url":"https://api.github.com/users/gasman/events{/privacy}","received_events_url":"https://api.github.com/users/gasman/received_events","type":"User","site_admin":false},"open_issues":52,"closed_issues":73,"state":"open","created_at":"2015-08-28T16:20:42Z","updated_at":"2015-10-23T12:20:28Z","due_on":"2015-09-29T23:00:00Z","closed_at":null},"comments":3,"created_at":"2015-09-28T09:57:19Z","updated_at":"2015-10-23T12:59:36Z","closed_at":"2015-10-23T12:20:28Z","body":"We are getting this quite a lot.\r\n\r\nWe have  a Sentry report over here: https://beta.getsentry.com/share/group/34313638322e3833333433303131/\r\n\r\n```\r\nMultipleObjectsReturned: get() returned more than one Embed -- it returned 2!\r\n  File \"django/core/handlers/base.py\", line 137, in get_response\r\n    response = response.render()\r\n  File \"django/template/response.py\", line 103, in render\r\n    self.content = self.rendered_content\r\n  File \"django/template/response.py\", line 80, in rendered_content\r\n    content = template.render(context)\r\n  File \"django/template/base.py\", line 148, in render\r\n    return self._render(context)\r\n  File \"django/template/base.py\", line 142, in _render\r\n    return self.nodelist.render(context)\r\n  File \"django/template/base.py\", line 844, in render\r\n    bit = self.render_node(node, context)\r\n  File \"django/template/base.py\", line 858, in render_node\r\n    return node.render(context)\r\n  File \"django/template/loader_tags.py\", line 126, in render\r\n    return compiled_parent._render(context)\r\n  File \"django/template/base.py\", line 142, in _render\r\n    return self.nodelist.render(context)\r\n  File \"django/template/base.py\", line 844, in render\r\n    bit = self.render_node(node, context)\r\n  File \"django/template/base.py\", line 858, in render_node\r\n    return node.render(context)\r\n  File \"django/template/loader_tags.py\", line 65, in render\r\n    result = block.nodelist.render(context)\r\n  File \"django/template/base.py\", line 844, in render\r\n    bit = self.render_node(node, context)\r\n  File \"django/template/base.py\", line 858, in render_node\r\n    return node.render(context)\r\n  File \"django/template/base.py\", line 904, in render\r\n    return render_value_in_context(output, context)\r\n  File \"django/template/base.py\", line 881, in render_value_in_context\r\n    value = force_text(value)\r\n  File \"django/utils/encoding.py\", line 83, in force_text\r\n    s = six.text_type(s)\r\n  File \"wagtail/wagtailcore/blocks/stream_block.py\", line 311, in __str__\r\n    return self.stream_block.render(self)\r\n  File \"wagtail/wagtailcore/blocks/base.py\", line 216, in render\r\n    return self.render_basic(value)\r\n  File \"wagtail/wagtailcore/blocks/stream_block.py\", line 201, in render_basic\r\n    [(force_text(child), child.block_type) for child in value]\r\n  File \"wagtail/wagtailcore/blocks/stream_block.py\", line 201, in <listcomp>\r\n    [(force_text(child), child.block_type) for child in value]\r\n  File \"django/utils/encoding.py\", line 83, in force_text\r\n    s = six.text_type(s)\r\n  File \"wagtail/wagtailcore/blocks/stream_block.py\", line 251, in __str__\r\n    return self.block.render(self.value)\r\n  File \"wagtail/wagtailcore/blocks/base.py\", line 216, in render\r\n    return self.render_basic(value)\r\n  File \"wagtail/wagtailcore/blocks/base.py\", line 223, in render_basic\r\n    return force_text(value)\r\n  File \"django/utils/encoding.py\", line 83, in force_text\r\n    s = six.text_type(s)\r\n  File \"wagtail/wagtailembeds/blocks.py\", line 21, in __str__\r\n    return embed_to_frontend_html(self.url)\r\n  File \"wagtail/wagtailembeds/format.py\", line 10, in embed_to_frontend_html\r\n    embed = embeds.get_embed(url)\r\n  File \"wagtail/wagtailembeds/embeds.py\", line 128, in get_embed\r\n    return Embed.objects.get(url=url, max_width=max_width)\r\n  File \"django/db/models/manager.py\", line 92, in manager_method\r\n    return getattr(self.get_queryset(), name)(*args, **kwargs)\r\n  File \"django/db/models/query.py\", line 361, in get\r\n    num if num <= MAX_GET_RESULTS else 'more than %s' % MAX_GET_RESULTS\r\n```"},"comment":{"url":"https://api.github.com/repos/torchbox/wagtail/issues/comments/150563508","html_url":"https://github.com/torchbox/wagtail/issues/1745#issuecomment-150563508","issue_url":"https://api.github.com/repos/torchbox/wagtail/issues/1745","id":150563508,"user":{"login":"lee-kagiso","id":11830393,"avatar_url":"https://avatars.githubusercontent.com/u/11830393?v=3","gravatar_id":"","url":"https://api.github.com/users/lee-kagiso","html_url":"https://github.com/lee-kagiso","followers_url":"https://api.github.com/users/lee-kagiso/followers","following_url":"https://api.github.com/users/lee-kagiso/following{/other_user}","gists_url":"https://api.github.com/users/lee-kagiso/gists{/gist_id}","starred_url":"https://api.github.com/users/lee-kagiso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lee-kagiso/subscriptions","organizations_url":"https://api.github.com/users/lee-kagiso/orgs","repos_url":"https://api.github.com/users/lee-kagiso/repos","events_url":"https://api.github.com/users/lee-kagiso/events{/privacy}","received_events_url":"https://api.github.com/users/lee-kagiso/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T12:59:35Z","updated_at":"2015-10-23T12:59:35Z","body":"We are using Postgres...\n\nOn Fri, Oct 23, 2015 at 2:20 PM, Matt Westcott <notifications@github.com>\nwrote:\n\n> @lee-kagiso <https://github.com/lee-kagiso> I take it you're using SQLite\n> as your database backend (based on the lack of postgresql / mysql client\n> library under Packages in the Sentry report)?\n>\n> We have a unique_together constraint on the Embed model which *should*\n> prevent these duplicates from occurring at the database level:\n> https://github.com/torchbox/wagtail/blob/8bf9851e01e8a5128cfc9d235b165d23954fdb41/wagtail/wagtailembeds/models.py#L41.\n> However, according to\n> http://stackoverflow.com/questions/8844283/django-unique-together-not-preventing-duplicates\n> these are not respected by SQLite. If so, I don't think there's much we can\n> do to avoid this on SQLite.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/torchbox/wagtail/issues/1745#issuecomment-150557350>.\n>\n"}}