django-href 0.2.2
Django package for shortening URLs
This is a library for using the http://href.be/ short URL service, it has a real simple API, for more information see http://href.be/api
Usage
First install the django_href project in one of you library dirs, you can install it globally using the setup.py script, just run python setup.py install.
Now you have to tell your settings.py to load the appropriate libraries:
INSTALLED_APPS = (
...
# required by django_href
'django.contrib.contenttypes',
'django_href',
)
After doing this, install the database schemes using manage.py with python manage.py syncdb.
Template tags and filters
You can load the template tags using {% load href %} in the top of your template(s).
Filtering a single link
You can filter the link for a single object using the shorten template filter:
Please visit <a href="{{ obj|shorten }}">{{ obj.get_absolute_url }}</a>.
You can also choose to automatically shorten all links in the block with the autoshorten block tag:
{% autoshorten %}
Please visit the <a href="http://pypi.python.org/">Cheese Shop</a>.
{% endautoshorten %}
This will result in:
Please visit the <a href="http://href.be/j">Cheese Shop</a>.
Bugs / issues
Please post your bugs, issues and remarks on the Git Hub issue tracker at http://github.com/tehmaze/django-href/issues
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| django-href-0.2.2.tar.gz (md5) | Source | 2010-07-22 | 3KB | 348 | |
- Author: Wijnand Modderman
- Home Page: http://github.com/tehmaze/django-href
- License: MIT
- Platform: any
- Requires django (>=1.1)
- Provides django_href
- Package Index Owner: tehmaze
- DOAP record: django-href-0.2.2.xml
