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

This makes your application be able to write simple urlpatterns with dictionary for Django

Project Description

In, you can write urlpatterns by using dictionary.

from django.conf.urls import include
from django.contrib import admin

from dictpatterns.urls import DictPatterns

UrlDictPatterns = DictPatterns(
        r'^': ('testapp.views.home', 'home',
                r'test/': ('testapp.views.test', 'test',
                        r'(?P<id>\d*)/': ('testapp.views.test_n', 'test_n',
                                r'd/': ('testapp.views.test_d', 'test_d')
                r'admin/': (include(, 'admin')

urlpatterns = UrlDictPatterns.to_patterns()

In template

Because of this format, you can trace the parent url of a page. You can display the parent url in template.

{% load dict_url_tools %}

Now :
{% this_url %}
Parent :
{% parent_url %}


Make sure of writing DictPatterns in your urls which is designated as ROOT_URLCONF. And designate the root of DictPatterns as ROOT_DICTPATTERNS_NAME in if you need. Default value is “UrlDictPatterns”.

Release History

This version
History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(3.4 kB) Copy SHA256 Hash SHA256
Source None Apr 6, 2014

Supported By

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 Google Google Cloud Servers DreamHost DreamHost Log Hosting