skip to navigation
skip to content

django-dictpatterns 0.2

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

Latest Version: 0.2.1

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 distinguished as ROOT_URLCONF. And distinguish 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.tar.gz (md5) Source 2014-04-06 3KB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 0 downloads in the last week
  • 105 downloads in the last month