コード例 #1
0
ファイル: urls.py プロジェクト: brBart/pombola
    ))

# Add view for people with names starting with a prefix
organisation_patterns.insert(
    0,
    url(
        r'^(?P<slug>[-\w]+)/people/(?P<person_prefix>[\w]+)$',
        SAOrganisationDetailSubPeople.as_view(sub_page='people'),
        name='organisation_people_prefix',
    ))

person_patterns = copy.copy(person_patterns)

new_person_url = url(
    r'^(?P<slug>[-\w]+)/$',
    SAPersonDetail.as_view(),
    name='person',
)

new_person_appearances_url = url(r'(?P<slug>[-\w]+)/appearances/$',
                                 RedirectView.as_view(pattern_name='person',
                                                      permanent=False),
                                 name='sa-person-appearances')

for index, pattern in enumerate(person_patterns):
    if pattern.name == 'person':
        person_patterns[index] = new_person_url
    elif pattern.name == 'person_appearances':
        person_patterns[index] = new_person_appearances_url

# Catch /person/{person_slug}/appearances/{speech_tag} urls and serve the
コード例 #2
0
ファイル: urls.py プロジェクト: ken-muturi/pombola
            r'^(?P<slug>[-\w]+)/$', SAOrganisationDetailView.as_view(), name='organisation')

#add organisation party sub-page
organisation_patterns += patterns(
    'pombola.south_africa.views',
    url(
        '^(?P<slug>[-\w]+)/party/(?P<sub_page_identifier>[-\w]+)/$',
        SAOrganisationDetailSubParty.as_view(),
        name='organisation_party',
    )
)

# Override the person url so we can add some extra data
for index, pattern in enumerate(person_patterns):
    if pattern.name == 'person':
        person_patterns[index] = url(r'^(?P<slug>[-\w]+)/$', SAPersonDetail.as_view(), name='person')

# Override the home view:
urlpatterns = patterns('',
    url(r'^$', SAHomeView.as_view(), name='home'),
)

# Catch /person/{person_slug}/appearances/{speech_tag} urls and serve the
# appropriate content.
urlpatterns += patterns('',

    # FIXME - implement a redirect to /persons/joe-bloggs#appearances when #930
    # done
    # url(r'^person/(?P<person_slug>[-\w]+)/appearances/$', ........ ),
    url(r'^person/(?P<slug>[-\w]+)/appearances/$',
        RedirectView.as_view(pattern_name='person', permanent=False),
コード例 #3
0
ファイル: urls.py プロジェクト: Code4SA/pombola
    )

# Add view for people with names starting with a prefix
organisation_patterns.insert(
    0,
    url(r'^(?P<slug>[-\w]+)/people/(?P<person_prefix>[\w]+)$',
        SAOrganisationDetailSubPeople.as_view(sub_page='people'),
        name='organisation_people_prefix',
        )
    )

person_patterns = copy.copy(person_patterns)

new_person_url = url(
    r'^(?P<slug>[-\w]+)/$',
    SAPersonDetail.as_view(),
    name='person',
    )

new_person_appearances_url = url(
    r'(?P<slug>[-\w]+)/appearances/$',
    RedirectView.as_view(pattern_name='person', permanent=False),
    name='sa-person-appearances')

for index, pattern in enumerate(person_patterns):
    if pattern.name == 'person':
        person_patterns[index] = new_person_url
    elif pattern.name == 'person_appearances':
        person_patterns[index] = new_person_appearances_url

# Catch /person/{person_slug}/appearances/{speech_tag} urls and serve the