Exemple #1
0
    # that on the site. This is to fix originally using the word 'candidates'
    # and can probably be removed at some point when there are no more hits on
    # this path - after July 2013 feels about right.
    url(
        r'^(?P<slug>[-\w]+)/candidates/$',
        RedirectView.as_view(url='/place/%(slug)s/aspirants', permanent=True),
    ),
)

# ugly, must be a better way
for sub_page in ['aspirants', 'election', 'scorecard', 'comments', 'people', 'places', 'organisations', 'data', 'projects']:
    place_patterns += patterns(
        'pombola.core.views',
        url(
            '^(?P<slug>[-\w]+)/%s/' % sub_page,  # url regex
            PlaceDetailSub.as_view(),            # view function
            { 'sub_page': sub_page },            # pass in the 'sub_page' arg
            'place_%s' % sub_page                # url name for {% url ... %} tags
        )
    )


organisation_patterns = patterns('pombola.core.views',
    url(r'^all/', OrganisationList.as_view(), name='organisation_list'),
    url(r'^is/(?P<slug>[-\w]+)/', OrganisationKindList.as_view(), name='organisation_kind'),
    url(r'^(?P<slug>[-\w]+)/$', OrganisationDetailView.as_view(), name='organisation'),
)

# ugly, must be a better way
for sub_page in ['comments', 'contact_details', 'people']:
    organisation_patterns += patterns(
Exemple #2
0
    # redirect .../candidates to .../aspirants so that the URL wording matches
    # that on the site. This is to fix originally using the word 'candidates'
    # and can probably be removed at some point when there are no more hits on
    # this path - after July 2013 feels about right.
    url(
        r'^(?P<slug>[-\w]+)/candidates/$',
        RedirectView.as_view(url='/place/%(slug)s/aspirants', permanent=True),
    ),
)

for sub_page in ['aspirants', 'election', 'scorecard', 'comments', 'people', 'places', 'organisations', 'data', 'projects']:
    place_patterns += patterns(
        'pombola.core.views',
        url(
            '^(?P<slug>[-\w]+)/%s/' % sub_page,
            PlaceDetailSub.as_view(sub_page=sub_page),
            name='place_%s' % sub_page,
        )
    )


organisation_patterns = patterns('pombola.core.views',
    url(r'^all/', OrganisationList.as_view(), name='organisation_list'),
    url(r'^is/(?P<slug>[-\w]+)/', OrganisationKindList.as_view(), name='organisation_kind'),
    url(r'^(?P<slug>[-\w]+)/$', OrganisationDetailView.as_view(), name='organisation'),
)

for sub_page in ['comments', 'contact_details', 'people']:
    organisation_patterns += patterns(
        'pombola.core.views',
        url(
Exemple #3
0
    url(
        r'^(?P<slug>[-\w]+)/candidates/$',
        RedirectView.as_view(url='/place/%(slug)s/aspirants', permanent=True),
    ),
)

# ugly, must be a better way
for sub_page in [
        'aspirants', 'election', 'scorecard', 'comments', 'people', 'places',
        'organisations', 'data', 'projects'
]:
    place_patterns += patterns(
        'pombola.core.views',
        url(
            '^(?P<slug>[-\w]+)/%s/' % sub_page,  # url regex
            PlaceDetailSub.as_view(),  # view function
            {'sub_page': sub_page},  # pass in the 'sub_page' arg
            'place_%s' % sub_page  # url name for {% url ... %} tags
        ))

organisation_patterns = patterns(
    'pombola.core.views',
    url(r'^all/', OrganisationList.as_view(), name='organisation_list'),
    url(r'^is/(?P<slug>[-\w]+)/',
        OrganisationKindList.as_view(),
        name='organisation_kind'),
    url(r'^(?P<slug>[-\w]+)/$',
        OrganisationDetailView.as_view(),
        name='organisation'),
)