Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Extension to the mezzanine twitter app adding topics and queries configurable from the admin interface.

branch: master
README.md

mezzanine-twittertopic

Extension to the mezzanine twitter app adding topics and queries configurable from the admin interface.

Installation

Place mezzanine-twittertopic into your mezzanine project directory in a directory named "twittertopic".

Configure twittertopic as one of your apps by editing your settings.py and add "twittertopic" to INSTALLED_APPS.

Add the following to your ADMIN_MENU_ORDER in settings.py::

("Twitter", ("twittertopic.Topic", "twitter.Query",)),

where you may need to uncomment ADMIN_MENU_ORDER. twittertopic will work fine if this is not done but configuring queries and topics will appear in two separate menus in the admin interface.

Templates

One new template tag is available with this package: twitter_topic. The usage is identical to the tag tweets_for_user which expects a single argument as a string::

{% tweets_for_user "stephen_mcd" %}

and which is then displayed by the example twitter.html available in mezzanine.

For the new tag using a defined topic, use::

{% tweets_on "News" %}

where News is a topic defined in the next section.

Configuration

Go to the admin interface and and select Twitter\Twitter queries. There are three types of queries available::

User, which expects a particular twitter feed (e.g. stephen_mcd) Search, which expects a search term (e.g. mezzanine) List, which expects a particular feed (e.g. stephen_mcd)

Enter one or a few queries; if you have already used tweets_for_user or one of the other template tags shipped with mezzanine then you will find those queries already defined in configuration.

Then select Twitter\Topics and define one or a few topics. To match the example above, define a topic named "News" and associate it with one or more of your previously-defined queries.

Updating Feeds

Once everything is configured, tweets will be retrieved and available for display by running the following command from your project directory::

python manage.py poll_topics

which should be run from a cron job on a regular basis.

.. note::

The original mezzanine template tags tweets_for_user etc will retrieve content from feeds when they are invoked by accessing a page. This will not happen when using tweets_on; new content will only appear if manage.py poll_topics is run.

Something went wrong with that request. Please try again.