Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

An implementation of rev=canonical url shortening for Django.

Project Description

This is an implementation of rev=canonical url shortening in the form of Django application. Basically rev=canonical is nice idea about that site should give you two links to actual page: one is human-readable, and another is short version, intented to use in limited conditions.

This implementation is modelled after Simon Willison’s post and returns 301 permanent redirect for your short urls.

Configuration

Installation is simple - use it like any another Django application, basically: put it where other application of your project are residing and add 'revcanonical' to INSTALLED_APPS in settings.py. Then edit your urls.py and add inclusion of revcanonical’s urls to urlpatterns:

url(r'', include('revcanonical.urls')),

Use r'^someprefix/' instead of first argument if you’d like to see prefixed urls.

By default revcanonical uses internal Django’s Site model to determine your site domain, but you can set it manually in settings.py as REVCANONICAL_SITE variable.

Usage

Include such code in your template between <head> and </head> tags:

{% load revcanontags %}
{% revcanonical object %}

Of course, you should replace object with your own object variable. And, naturally, it should have get_absolute_url() method.

Additionally you can set your <a href> links to short urls:

{% load revcanontags %}
<a href="{% shorturl object %}">...</a>
Release History

Release History

This version
History Node

1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-revcanonical-1.0.tar.gz (3.6 kB) Copy SHA256 Checksum SHA256 Source Apr 13, 2009

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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