Skip to main content

django-keyed-urls

https://travis-ci.org/matthiask/django-keyed-urls.png?branch=master

An app for those cases when you want database-configurable URLs.

Installation

Install django-keyed-urls with pip:

pip install django-keyed-urls

Add keyed_urls and modeltranslation to INSTALLED_APPS.

Specify a custom location for South migrations for keyed_urls – you really want to use South to handle schema changes when adding or removing languages from LANGUAGES:

SOUTH_MIGRATION_MODULES = {
    'keyed_urls': 'yourapp.migrate.keyed_urls',
}

Create and run database migrations:

python manage.py schemamigration keyed_urls --initial
python manage.py migrate keyed_urls

If you want to use the forwarding URLs, add an entry to your URLconf file. It is recommended to use i18n_patterns because that means that language-specific redirection URLs are automatically handled correctly:

from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns

urlpatterns += i18n_patterns(
    '',
    url(r'', include('keyed_urls.urls'),
)

Usage

Template tags

Usage is simple:

{% load keyed_urls %}

{% keyed_url 'some_key' as url %}

<a href="{{ url }}">bla</a>

Or:

{% load keyed_urls %}

{% keyed_url 'some_key' language='en' as url %}

<a href="{{ url }}">bla</a>

Helpers

TODO Describe keyed_urls.get_url and keyed_urls.get_forwarding_url.

Metadata

Release files for django-keyed-urls 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-keyed-urls 0.2.0
File Size Uploaded
django-keyed-urls-0.2.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-keyed-urls 0.2.0
File Interpreter ABI Platform
django_keyed_urls-0.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 15.4 kB

Release files / django-keyed-urls-0.2.0.tar.gz

Download URL django-keyed-urls-0.2.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7232c3b0c89363e4975a5b221b8bdb650e23ff229b93c23f915b44c43d19a520
BLAKE2b-256 checksum
How to use checksums
53f42fada4593cdbf3f26fdc7b0f436936dd9aa7c0593051e5418ac68f437302
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_keyed_urls-0.2.0-py2.py3-none-any.whl

Download URL django_keyed_urls-0.2.0-py2.py3-none-any.whl
Size 9.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
909897f9699a78cd995dfb05269278eb5f89d148c784339a1ad3a011319e40e6
BLAKE2b-256 checksum
How to use checksums
cb6a60905f67ec376d32c76913f61ee4d5e3f8a1aaa7b60b9c9a5b7a072a5f6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page