<commit_before>==============================
The syndication feed framework
==============================

.. module:: django.contrib.syndication
   :synopsis: A framework for generating syndication feeds, in RSS and Atom,
              quite easily.

Django comes with a high-level syndication-feed-generating framework
that makes creating RSS_ and Atom_ feeds easy.

To create any syndication feed, all you have to do is write a short
Python class. You can create as many feeds as you want.

Django also comes with a lower-level feed-generating API. Use this if
you want to generate feeds outside of a Web context, or in some other
lower-level way.

.. _RSS: http://www.whatisrss.com/
.. _Atom: http://www.atomenabled.org/

The high-level framework
========================

Overview
--------

The high-level feed-generating framework is supplied by the
:class:`~django.contrib.syndication.views.Feed` class. To create a
feed, write a :class:`~django.contrib.syndication.views.Feed` class
and point to an instance of it in your :doc:`URLconf
</topics/http/urls>`.

Feed classes
------------

A :class:`~django.contrib.syndication.views.Feed` class is a Python
class that represents a syndication feed. A feed can be simple (e.g.,
a "site news" feed, or a basic feed displaying the latest entries of a
blog) or more complex (e.g., a feed displaying all the blog entries in
a particular category, where the category is variable).

Feed classes subclass :class:`django.contrib.syndication.views.Feed`.
They can live anywhere in your codebase.

Instances of :class:`~django.contrib.syndication.views.Feed` classes
are views which can be used in your :doc:`URLconf </topics/http/urls>`.

A simple example
----------------

This simple example, taken from `chicagocrime.org`_, describes a feed of the
latest five news items::

    from django.contrib.syndication.views import Feed
    from chicagocrime.models import NewsItem

    class LatestEntriesFeed(Feed):
        title = "Chicagocrime.org site news"
        link = "/sitenews/"
        description = "Updates on changes and additions to chicagocrime.org."

        def items(self):
            return NewsItem.objects.order_by('-pub_date')[:5]

        def item_title(self, item):
            return item.title

        def item_description(self, item):
            return item.description<commit_msg>[1.5.X] Fixed #19306 - Improved syndication example.<commit_after>==============================
The syndication feed framework
==============================

.. module:: django.contrib.syndication
   :synopsis: A framework for generating syndication feeds, in RSS and Atom,
              quite easily.

Django comes with a high-level syndication-feed-generating framework
that makes creating RSS_ and Atom_ feeds easy.

To create any syndication feed, all you have to do is write a short
Python class. You can create as many feeds as you want.

Django also comes with a lower-level feed-generating API. Use this if
you want to generate feeds outside of a Web context, or in some other
lower-level way.

.. _RSS: http://www.whatisrss.com/
.. _Atom: http://www.atomenabled.org/

The high-level framework
========================

Overview
--------

The high-level feed-generating framework is supplied by the
:class:`~django.contrib.syndication.views.Feed` class. To create a
feed, write a :class:`~django.contrib.syndication.views.Feed` class
and point to an instance of it in your :doc:`URLconf
</topics/http/urls>`.

Feed classes
------------

A :class:`~django.contrib.syndication.views.Feed` class is a Python
class that represents a syndication feed. A feed can be simple (e.g.,
a "site news" feed, or a basic feed displaying the latest entries of a
blog) or more complex (e.g., a feed displaying all the blog entries in
a particular category, where the category is variable).

Feed classes subclass :class:`django.contrib.syndication.views.Feed`.
They can live anywhere in your codebase.

Instances of :class:`~django.contrib.syndication.views.Feed` classes
are views which can be used in your :doc:`URLconf </topics/http/urls>`.

A simple example
----------------

This simple example, taken from `chicagocrime.org`_, describes a feed of the
latest five news items::

    from django.contrib.syndication.views import Feed
    from django.core.urlresolvers import reverse
    from chicagocrime.models import NewsItem

    class LatestEntriesFeed(Feed):
        title = "Chicagocrime.org site news"
        link = "/sitenews/"
        description = "Updates on changes and additions to chicagocrime.org."

        def items(self):
            return NewsItem.objects.order_by('-pub_date')[:5]

        def item_title(self, item):
            return item.title

        def item_description(self, item):
            return item.description

        # item_link is only needed if NewsItem has no get_absolute_url method.
        def item_link(self, item):
            return reverse('news-item', args=[item.pk])
{'fraction_non_alphanumeric': 0.12693623013478172, 'fraction_numerical': 0.0018105009052504525, 'mean_word_length': 3.4551971326164876, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '3606359', 'n_tokens_mistral': 1408, 'n_tokens_neox': 1359, 'n_words': 544}