Beispiel #1
0
# coding=utf-8
from .views import *
from django.conf.urls.defaults import include, patterns, url
from politics.utils.urls import prefix

# /issues/{pk}/
issue_prefix = r"^(?P<pk>\d+)/"
issue_patterns = prefix(issue_prefix, patterns("",
    url(r"$", issues.show, name="show")
))

urlpatterns = patterns("",
    url(r"^issues/", include(issue_patterns, namespace="issues"))
)
Beispiel #2
0
# coding=utf-8
from .views import *
from django.conf.urls.defaults import include, patterns, url
from politics.utils.urls import prefix


# /ajax/
ajax_patterns = patterns("",
    url(r"^tags/$", ajax.tags, name="tags"),
    url(r"^title/$", ajax.title, name="title"),
)

# /elections/{pk}-{slug}/
election_prefix = r"^(?P<pk>\d+)(?:-(?P<slug>[a-z0-9_-]*))?/"
election_patterns = prefix(election_prefix, patterns("",
    url(r"$", elections.show, name="show"),
    url(r"parties/$", elections.show, {"tab": "parties"}, name="show-parties")
))

# /elections/
elections_patterns = patterns("",
    url(r"^$", elections.list, name="list")
) + election_patterns

# /issues/{pk}-{slug}/
issue_prefix = r"^(?P<issue_pk>\d+)(?:-(?P<issue_slug>[a-z0-9_-]*))?/"
issue_patterns = prefix(issue_prefix, patterns("",
    url(r"$", issues.show, name="show"),
    url(r"edit/$", issues.form, name="edit"),
    url(r"parties/(?P<party_pk>\d+)(?:-(?P<party_slug>[a-z0-9_-]*))?/",
        views.show, name="view")
))