This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
Switter app description

Switter is a drop-in Django app that gets tweets for you, keeps them cached for a short while and makes it easy to display them on your site:

- **backend** part - fetches and caches tweets from Twitter 1.1 API,
- **frontend** part - is slightly modified version of a popular **jquery.tweet.js** plugin, that uses Switter backend instead of talking directly to Twitter API,
- **django-cms plugin** that makes use of Switter backend and forntend in an easy and pleasant way: when cached tweets are fresh enogh, it doesn't even make any ajax call, they're rendered right away.


* To install ::

pip install django-switter

* Add ``'switter'`` to your ``INSTALLED_APPS`` setting::

# other apps
"switter.plugins", # this one is for django-cms

* Add Switter url patterns to your main ::

urlpatterns = patterns('',
url(r'^switter/', include('switter.urls')),

* And update your database::

python migrate switter
python migrate switter.plugins

* Or just ``syncdb`` if you don't use South migrations::

python syncdb


* Register a Twitter app, get your Twitter OAuth credentials and put them into your ::


* Once installed it's pretty straighforward to use cms plugin - just add it yo your pages! ::

* Fine tune Switter plugin by overriding ``cms/plugins/switter/default.html`` template ::

{# cms/plugins/switter/default.html #}
{% load sekizai_tags %}

<section class="switter" id="switter-{{ }}">
{% if object.header %}
<h2>{{ object.header }}</h2>
{% endif %}

<ul class="tweets">{# loading... #}</ul>

{% addtoblock "js" %}
<script type="text/javascript">
$('#switter-{{ }} .tweets').switter({
// these 3 are Switter-specific:
url: '{% url switter_tweets query_type=object.query_type %}',
url_params: {{ object.get_jquery_ajax_data|safe }},
preloaded_tweets: {{ object.get_tweets_json|safe }},

// put the rest of your usual jquery.tweet.js configuration here...
count: {{ object.count }},
loading_text: "Oooh, loading tweets...",

// for example fancy tweet template:
template: '<p>{text}</p><a class="tweet_time" href="{tweet_url}">{time}</a> <a class="tweet_user" href="{user_url}">by @{screen_name}</a>'
{% endaddtoblock %}

* Not using django-cms? Not a problem! Just use modified Switter plugin template code and include it in your templates ::

{# my/fancy/switter/_tweets.html to be included here and there #}
<section id="switter">
<h2>Our tweets</h2>
<ul class="tweets"></ul>

{# you probably want to paste this in the bottom of your base.html #}
<script type="text/javascript">
// add this javascript at the bottom of your base.html template
// get user timeline...
var switter_url = '{% url switter_tweets query_type='user_timeline' %}'
var switter_url_params = {
screen_name: 'verybritishproblems',
count: 5,
exclude_replies: false, // optional
include_rts: true // optional

// or any Twitter search results:
var switter_url = '{% url switter_tweets query_type='search' %}'
var switter_url_params = {
q: 'from:verybritishproblems', // twitter search query
count: 5

$('#switter .tweets').switter({
// these 3 are Switter-specific:
url: switter_url,
url_params: switter_url_params,
preloaded_tweets: {{ my_cached_tweets_json|safe }}, // optional (will ajax for tweets if not present)

// put the rest of your usual jquery.tweet.js configuration here...
count: 5
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-switter-0.1.tar.gz (14.6 kB) Copy SHA256 Checksum SHA256 Source Jun 16, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting