Skip to main content
https://badge.fury.io/py/django_filtered_feed.png https://travis-ci.org/alixedi/django_filtered_feed.png?branch=master https://pypip.in/d/django_filtered_feed/badge.png https://coveralls.io/repos/alixedi/django_filtered_feed/badge.png

So the average-joe RSS is binary ie either you subscribe to a feed or you don’t. This approach results in a ridiculous amount of junk in our inbox. What if we could subscribe define the feed that we would like to subscribe to? Thanks to the stellar django syndication framework and django filters, I was able to hack together a fix.

If you have a Book model like so:

class Book(models.Model):
    name = models.CharField(max_length=256)
    pages = models.IntegerField()

def __unicode__(self):
    return self.name

A django_filter FilterSet like so:

class BookFilterSet(django_filters.FilterSet):
    pages = django_filters.NumberFilter(lookup_type='lt')
    class Meta:
        model = Book
        fields = ['pages']

A FilteredFeed class like so:

class BookFilteredFeed(BaseFilteredFeed):
    model = Book
    filter_set = BookFilterSet
    title = "BookFeed"
    link = "http://localhost:8000"
    description = "Get alerts for new books - less than given number of pages!"

    def item_link(self, item):
        return reverse('book_detail', args=[item.id])

Hook up the necessary urls like so:

urlpatterns = patterns('',
    url(r'^books/feed$', BookFilteredFeed.as_view(), name='book_feed'),
)

And finally, if we have the following 3 books in our DB:

  1. Introduction to Python (100 pages)

  2. Introduction to C (300 pages)

  3. Javascript - The good parts (300 pages)

Hitting http://localhost:8000/books/feed will give you an RSS feed includes:

  • Introduction to Python

  • Introduction to C

  • Javascript - The good parts

And hitting http://localhost:8000/books/feed?pages=200 will give you an RSS feed that just includes:

  • Introduction to Python

You users will forever remain grateful for sparing them the deluge that follows a binary subscription. You will be hailed the king of syndication, worshipped as a rock star and live happily ever after. The best part is that it takes a minute to get started:

pip install django_filtered_feed

Followed ofcourse by including filtered_feed in your INSTALLED_APPS.

INSTALLED_APPS = (
    ...
    'filtered_feed',
    ...
)

History

0.1.0 (2014-08-18)

  • First release on PyPI.

Metadata

Release files for django_filtered_feed 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django_filtered_feed 0.1.0
File Size Uploaded Provenance
django_filtered_feed-0.1.0.tar.gz 14.2 kB Without provenance Details

Release files / django_filtered_feed-0.1.0.tar.gz

Download URL django_filtered_feed-0.1.0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
64fdd25cf4653ff0e29f48fe13c6651d7b66cb82c9ef5b9da3b3a50e9f587221
BLAKE2b-256 checksum
How to use checksums
45532fab4aab6797cccfd8e1bbc737248bd6535aef3d936dff617d6e63a49195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django_filtered_feed 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page