Takes a tweet url, requests the json from Twitter oEmbed, parses the json for the html element and returns it to your template. The html returned is ready to go and will be shown as a tweet on your web page. This uses the Requests library for Python. A full example can be found on GitHub https://github.com/z3ke1r/django-tweet-embed.
Django Template Filter that parse a tweet in plain text and turn it with working Urls
Ceck it on [GitHub](https://github.com/VincentLoy/tweetparser-django-template-filter)
# tweetParser Django Template Filter
this is a port of [tweetParser.js](https://github.com/VincentLoy/tweetParser.js) to work as a Django template filter
## How does it work ?
Once installed, just :
```
<p>{{ your_tweet|tweetparser }}</p>
```
## Installation
Take a look at the [Django Documentation](https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/)
#### You can change the classes given to each anchor tags
```
USER_CLASS = 'tweet_user'
URL_CLASS = 'tweet_url'
HASHTAG_CLASS = 'hashtag'
```
Based on [http://djangosnippets.org/snippets/1615/](http://djangosnippets.org/snippets/1615/)
Added tweets cache. Cache time is configurable through project settings: TWITTER_TIMEOUT=300. Default time is 300 seconds = 5 minutes.
This improve performance by reducing the twitter api queries interval.
This template can be included by other template passing the vars page_url and title:
{% with content.get_url as page_url %}
{% with content.title as title %}
{% include 'share.html' %}
{% endwith %}
{% endwith %}
A simple template filter for parsing tweets (linking @ replies, hashtages and standard URLs whilst stripping out links to yFrog and TwitPic images), and two simple tags for displaying the yFrog and TwitPic images linked to in tweets.
If you put the snippet in a file called tweets.py, as long as it lives in an app's templatetags directory, you should be able to do the following (where `text` refers to the text of a tweet):
{% load twitter %}
<p>{{ text|tweet }}</p>
{% yfrog_images text 1 'fancybox' %}
{% twitpic_images text 1 'fancybox' %}
The first argument in the two tags controls how many images to render. Set this to -1 for an unlimited number, per tweet.
Thumbnail images are displayed, and you can specify the class that is applied to the `<a>` tags rendered. Here I've used 'fancybox', and I would normally include jQuery code to turn the images inside the `<a>` tags into lightboxes.
Quick and simple twitterize filter to turn Twitter usernames into profile links on your own sites.
Add the filter code to your own template tags (http://docs.djangoproject.com/en/dev/howto/custom-template-tags/).
Improved version of my snippet #1346. Now works correctly with multiple usernames and hash tags.
Both twitter usernames and hashtags are converted into links to twitter profiles and twitter search.
Updated, forgot about underscores in usernames.
A template tag which returns the n last tweets of a given user.
It uses the twitter python lib.
{% get_twitter_messages user foo limit 5 as tweets %}
{% for tweet in tweets %}
{{ tweet.text }} {{ tweet.time }} {{ tweet.url }}
{% endfor %}
Assume you have a model called Delegate and you want to tweet whenever a new Delegate registers, the code above will do this. You need to install python-twitter.
TwitterBackend is the twitter authentication backend. This backend makes use of OAuth based "Sign-in with Twitter"
Configure your settings.py as per [Django - Specifying Authentication Backends](http://docs.djangoproject.com/en/dev/topics/auth/#specifying-authentication-backends)
This filter links twitter user names prefixed with '@', hash tags, and URLs.
Usage example:
`{{var|twitterize}}`
Note: Do not use this in conjunction with the urlize filter. Twitterize does this for you.
**UPDATE**: A more complete example is up on [GitHub](http://github.com/henriklied/django-twitter-oauth/tree/master)
Based around Simon Willison's [Fire Eagle oAuth](http://www.djangosnippets.org/snippets/655/), this will allow you to develop Twitter oAuth applications (…that is – if you're in the closed beta)
Adapted from #848 to basically copy the reply tag and create it again as a hash tag filter.
Kudos to ryanberg, not me.
will be in use on my website soon (www.dougalmatthews.com) for a demo.
Post new saved objects to Twitter.
**Example:**
from django.db import models
class MyModel(models.Model):
text = models.CharField(max_length=255)
link = models.CharField(max_length=255)
def __unicode__(self):
return u'%s' % self.text
def get_absolute_url(self):
return self.link
# the following method is optional
def get_twitter_message(self):
return u'my-custom-twitter-message: %s - %s' % (self.text, self.link)
models.signals.post_save.connect(post_to_twitter, sender=MyModel)