skip to navigation
skip to content

Not Logged In

django-dictpatterns 0.2.1

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

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”.

File Type Py Version Uploaded on Size
django-dictpatterns-0.2.1.tar.gz (md5) Source 2014-04-06 3KB
  • Downloads (All Versions):
  • 13 downloads in the last day
  • 55 downloads in the last week
  • 265 downloads in the last month