Git Product home page Git Product logo

django-wordpress-rss's Introduction

 =======================
||                      ||
|| Django WordPress RSS ||
||                      ||
 =======================

A Django template tag for integrating Wordpress articles.

Originally developed for the Seattle Times Election Guide <http://elections.seattletimes.com/>.

 ===============
|| Installation ||
 ===============

Install from PyPI using pip:

    pip install django-wordpress-rss

Add `wordpress_rss` to your settings.py file:

    INSTALLED_APPS = (
        ...
        'wordpress_rss',
        ...
    )

Add `WORDPRESS_RSS_BASE_URL` to your settings.py file, excluding the trailing slash:

    WORDPRESS_RSS_BASE_URL = 'http://www.kevinschaul.com'

 =========
|| Usage ||
 =========

Load the new template tag:

    {% load wordpress_rss %}

Configure it. The arguments are as follows:
1. The template tag (`wordpress_rss`)
2. A variable containing a string represenation of a category to pull from
3. A variable containing the number of articles to pull
4. (as)
5. A template variable to save the results in

The resulting template variable will be an array containing rss items, with proerties `href` and `title` (more are planned, feel free to open an issue on GitHub).

 ---------------
| Full example: |
 ---------------

settings.py

    ...
    WORDPRESS_RSS_BASE_URL = 'http://www.kevinschaul.com'
    ...

views.py

    ...
    return render(request, 'index.html', {'rss_category': 'widsom', 'quantity': 10})
    ...

index.html

    ...
    {% load wordpress_rss %}
    {% wordpress_rss rss_category quantity as rss_results %}
    <ul>
    {% for item in rss_results %}
        <li>
            <a href="{{ item.href }}">{{ item.title }}</a>
            <p>{{ item.summary }}</p>
        </li>
    {% endfor %}
    </ul>
    ...

django-wordpress-rss's People

Contributors

jwebcoder avatar kevinschaul avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.