<commit_before>from __future__ import unicode_literals

from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.utils.translation import ugettext_lazy as _

from compat import text_type

from .models import ResultEvent


class BasicResultEventsFeed(Feed):
    feed_type = Atom1Feed
    title = _("Election results from {site_name}").format(
        site_name=Site.objects.get_current().name
    )
    link = "/"
    description = _("A basic feed of election results")

    def items(self):
        return ResultEvent.objects.filter(created__gt="2016-05-04")

    def item_title(self, item):
        return _('{name} ({party}) won in {cons}').format(
            name=item.winner_person_name,
            party=item.winner_party_name,
            cons=item.post_name,
        )

    def item_description(self, item):
        message = _('A {site_name} volunteer recorded at {datetime} that '
            '{name} ({party}) won the ballot in {cons}, quoting the '
            "source '{source}').")
        return message.format(
            name=item.winner_person_name,
            datetime=item.created.strftime("%Y-%m-%d %H:%M:%S"),
            party=item.winner_party_name,<commit_msg>Only return results for this set of elections<commit_after>from __future__ import unicode_literals

from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import Atom1Feed
from django.utils.translation import ugettext_lazy as _

from compat import text_type

from .models import ResultEvent


class BasicResultEventsFeed(Feed):
    feed_type = Atom1Feed
    title = _("Election results from {site_name}").format(
        site_name=Site.objects.get_current().name
    )
    link = "/"
    description = _("A basic feed of election results")

    def items(self):
        return ResultEvent.objects.filter(created__gte="2017-05-04")

    def item_title(self, item):
        return _('{name} ({party}) won in {cons}').format(
            name=item.winner_person_name,
            party=item.winner_party_name,
            cons=item.post_name,
        )

    def item_description(self, item):
        message = _('A {site_name} volunteer recorded at {datetime} that '
            '{name} ({party}) won the ballot in {cons}, quoting the '
            "source '{source}').")
        return message.format(
            name=item.winner_person_name,
            datetime=item.created.strftime("%Y-%m-%d %H:%M:%S"),
            party=item.winner_party_name,
{'fraction_non_alphanumeric': 0.10817031070195628, 'fraction_numerical': 0.007671653241273495, 'mean_word_length': 3.0623052959501558, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2922194', 'n_tokens_mistral': 783, 'n_tokens_neox': 754, 'n_words': 188}