<commit_before>import datetime

from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
import django.utils.timezone as timezone

from toolkit.diary.models import Showing


class BasicWhatsOnFeed(Feed):
    # Generate a, err, basic "What's on" feed. Defines various methods that hook
    # into the django magic...
    DAYS_AHEAD = 7
    title = "Cube cinema forthcoming events"
    description = "Events at the cube cinema over the next %d days. E&OE." % (DAYS_AHEAD, )
    link = "/diary"

    def items(self):
        startdate = timezone.now()
        enddate = startdate + datetime.timedelta(days=self.DAYS_AHEAD)
        showings = (Showing.objects.filter(confirmed=True)
                                   .filter(hide_in_programme=False)
                                   .filter(start__range=[startdate, enddate])
                                   .filter(event__private=False)
                                   .order_by('start')
                                   .select_related())
        return showings.all()

    def item_title(self, showing):
        return showing.event.name

    def item_description(self, showing):
        description = showing.start.strftime("%d/%m/%Y %H:%M<br><br>") + showing.event.copy_html
        return description

    def item_link(self, showing):
        # Add the showing ID at the end to ensure that this link is unique (cf. RSS spec)
        return reverse("single-event-view", kwargs={'event_id': showing.event_id}) + "#" + str(showing.pk)<commit_msg>Don't append showing key to link to event page in RSS feed<commit_after>import datetime

from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse
import django.utils.timezone as timezone

from toolkit.diary.models import Showing


class BasicWhatsOnFeed(Feed):
    # Generate a, err, basic "What's on" feed. Defines various methods that hook
    # into the django magic...
    DAYS_AHEAD = 7
    title = "Cube cinema forthcoming events"
    description = "Events at the cube cinema over the next %d days. E&OE." % (DAYS_AHEAD, )
    link = "/diary"

    def items(self):
        startdate = timezone.now()
        enddate = startdate + datetime.timedelta(days=self.DAYS_AHEAD)
        showings = (Showing.objects.filter(confirmed=True)
                                   .filter(hide_in_programme=False)
                                   .filter(start__range=[startdate, enddate])
                                   .filter(event__private=False)
                                   .order_by('start')
                                   .select_related())
        return showings.all()

    def item_title(self, showing):
        return showing.event.name

    def item_description(self, showing):
        description = showing.start.strftime("%d/%m/%Y %H:%M<br><br>") + showing.event.copy_html
        return description

    def item_link(self, showing):
        # Add the showing ID at the end to ensure that this link is unique (cf. RSS spec)
        return reverse("single-event-view", kwargs={'event_id': showing.event_id})
{'fraction_non_alphanumeric': 0.09739633558341369, 'fraction_numerical': 0.0006428801028608164, 'mean_word_length': 2.314164004259851, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7354839', 'n_tokens_mistral': 886, 'n_tokens_neox': 848, 'n_words': 237}