) new_subplace_url = url( r'^(?P<slug>[-\w]+)/places/', SAPlaceDetailSub.as_view(sub_page='places'), name='place_places', ) for index, pattern in enumerate(place_patterns): if pattern.name == 'place': place_patterns[index] = new_place_url elif pattern.name == 'place_places': place_patterns[index] = new_subplace_url place_patterns.extend((url(r'^latlon/(?P<lat>[0-9\.-]+),(?P<lon>[0-9\.-]+)/$', LatLonDetailLocalView.as_view(), name='latlon'), )) urlpatterns = [ # Include the overriden person, organisation paths url(person_patterns_path, include(person_patterns)), url(place_patterns_path, include(place_patterns)), url(organisation_patterns_path, include(organisation_patterns)), # Override the home view: url(r'^$', SAHomeView.as_view(), name='home'), url(r'^position/member/parliament/?$', SAMembersView.as_view(), name='sa-members-view') ]
), # Provincial election, party list url( r'^election/(?P<election_year>[-\w]+)/provincial/(?P<province_name>[-\w]+)/(?P<party_name>[-\w]+)/$', views.SAElectionPartyCandidatesView.as_view(election_type='provincial'), name='sa-election-candidates-provincial-party', ), ) for index, pattern in enumerate(search_urlpatterns): if pattern.name == 'core_search': search_urlpatterns[index] = url(r'^$', SASearchView.as_view(), name='core_search') urlpatterns += patterns('pombola.south_africa.views', url(r'^place/latlon/(?P<lat>[0-9\.-]+),(?P<lon>[0-9\.-]+)/national/$', LatLonDetailNationalView.as_view(), name='latlon-national'), url(r'^place/latlon/(?P<lat>[0-9\.-]+),(?P<lon>[0-9\.-]+)/$', LatLonDetailLocalView.as_view(), name='latlon'), # We want to override the location search view, so that we can # redirect straight to the results page if there's a unique result # returned. url(r'^search/location/$', SAGeocoderView.as_view(), name='core_geocoder_search'), # because the following slug matches override this definition in the core # place_patterns, we reinstate it here url( r'^place/all/', PlaceKindList.as_view(), name='place_kind_all' ), url(r'^place/(?P<slug>[-\w]+)/$', SAPlaceDetailView.as_view(), name='place'), url(r'^place/(?P<slug>[-\w]+)/places/', SAPlaceDetailSub.as_view(sub_page='places'), name='place_places'),
SAPlaceDetailSub.as_view(sub_page='places'), name='place_places', ) for index, pattern in enumerate(place_patterns): if pattern.name == 'place': place_patterns[index] = new_place_url elif pattern.name == 'place_places': place_patterns[index] = new_subplace_url place_patterns.extend(( url(r'^latlon/(?P<lat>[0-9\.-]+),(?P<lon>[0-9\.-]+)/national/$', LatLonDetailNationalView.as_view(), name='latlon-national'), url(r'^latlon/(?P<lat>[0-9\.-]+),(?P<lon>[0-9\.-]+)/$', LatLonDetailLocalView.as_view(), name='latlon'), )) urlpatterns = patterns( '', # Include the overriden person, organisation paths (person_patterns_path, include(person_patterns)), (place_patterns_path, include(place_patterns)), (organisation_patterns_path, include(organisation_patterns)), # Override the home view: url(r'^$', SAHomeView.as_view(), name='home'), )