diff options
| author | Ben Firshman | 2014-09-20 18:52:16 -0700 |
|---|---|---|
| committer | Ben Firshman | 2014-09-21 11:45:49 -0700 |
| commit | d191fa22e08c6d38c13b89aca6c40356d77a9940 (patch) | |
| tree | 9ba590ce812a566f08cefb3f56a51b56ffc751c4 | |
| parent | 576af8b1060d8a8881ef54b3b8bd7cdb6ecb0a47 (diff) | |
| download | django-shorturls-d191fa22e08c6d38c13b89aca6c40356d77a9940.tar.bz2 | |
Convert readme to markdown
| -rw-r--r-- | README.md (renamed from README) | 49 |
1 files changed, 26 insertions, 23 deletions
@@ -11,11 +11,11 @@ slightly and packaged by Jacob Kaplan-Moss. Patches welcome: http://github.com/jacobian/django-shorturls Usage -===== +----- So, you want to host your own short URLs on your Django site: -1. In your settings, define a set of prefixes for short URLs:: +1. In your settings, define a set of prefixes for short URLs: SHORTEN_MODELS = { 'A': 'myapp.animal', @@ -33,12 +33,12 @@ So, you want to host your own short URLs on your Django site: Make sure your models have a ``get_absolute_url()`` method defined. -2. Wire up the redirect view by adding to your URLconf:: +2. Wire up the redirect view by adding to your URLconf: ('^short/', include('shorturls.urls')) 3. If you'd like to quickly link to shortened URLs in your templates, stick - ``"shorturls"`` in ``INSTALLED_APPS``, and then in your templates do:: + ``"shorturls"`` in ``INSTALLED_APPS``, and then in your templates do: {% load shorturl %} <a href="{% shorturl object %}">...</a> @@ -58,26 +58,29 @@ That's it. If you'd like more control, keep reading. Settings -======== +-------- Available settings are: -``SHORTEN_MODELS`` - You've seen this one. - -``SHORT_BASE_URL`` - If defined, the ``shorturl`` and ``revcanonical`` template tags will - prefix generated URLs with this value. Use this if you've got a shorter - domain name you'd like to use for small URLs. - - For example, given ``SHORT_BASE_URL = 'http://exm.pl/'``, ``{% shorturl - obj %}`` would return something like ``http://exm.pl/AbCd``. - -``SHORTEN_FULL_BASE_URL`` - The domain to redirect to when redirecting away from the small URL. - Again, you'll use this if your short URL base and your "real" site - differ. +#### ``SHORTEN_MODELS`` + +You've seen this one. - If not defined, the redirect view will try to guess the proper domain by - consulting the ``django.contrib.sites`` framework, if installed, or the - requested domain, if not. +#### ``SHORT_BASE_URL`` + +If defined, the ``shorturl`` and ``revcanonical`` template tags will +prefix generated URLs with this value. Use this if you've got a shorter +domain name you'd like to use for small URLs. + +For example, given ``SHORT_BASE_URL = 'http://exm.pl/'``, ``{% shorturl +obj %}`` would return something like ``http://exm.pl/AbCd``. + +#### ``SHORTEN_FULL_BASE_URL`` + +The domain to redirect to when redirecting away from the small URL. +Again, you'll use this if your short URL base and your "real" site +differ. + +If not defined, the redirect view will try to guess the proper domain by +consulting the ``django.contrib.sites`` framework, if installed, or the +requested domain, if not. |
