diff options
Diffstat (limited to 'chimere/urls.py')
-rw-r--r-- | chimere/urls.py | 75 |
1 files changed, 47 insertions, 28 deletions
diff --git a/chimere/urls.py b/chimere/urls.py index 164ef68..30ca844 100644 --- a/chimere/urls.py +++ b/chimere/urls.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2008-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -23,7 +23,7 @@ from django.contrib import admin from django.core.exceptions import ImproperlyConfigured admin.autodiscover() -from chimere.models import Area +from chimere.models import Map from chimere.feeds import LatestPOIsByCategory, LatestPOIsBySubCategory, \ LatestPOIs, LatestPOIsByZone, LatestPOIsByZoneID @@ -32,24 +32,24 @@ def i18n_javascript(request): urlpatterns = patterns('chimere.views', - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?simple$', 'index', {'simple':True}, + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?simple$', 'index', {'simple':True}, name="simple_index") ) if settings.CHIMERE_FEEDS: urlpatterns += patterns('', - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds$', 'chimere.views.rss', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?feeds$', 'chimere.views.rss', name='feeds-form'), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/category/(?P<category_id>\d+)$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?feeds/category/(?P<category_id>\d+)$', LatestPOIsByCategory(), name='feeds-cat'), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/subcategory/(?P<category_id>\d+)$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?feeds/subcategory/(?P<category_id>\d+)$', LatestPOIsBySubCategory(), name='feeds-subcat'), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/global/$', LatestPOIs(), + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?feeds/global/$', LatestPOIs(), name='feeds-global'), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/area/(?P<area>[0-9-_.]+)$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?feeds/area/(?P<area>[0-9-_.]+)$', LatestPOIsByZone(), name='feeds-area'), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?feeds/areaid/(?P<area_id>\d+)$', - LatestPOIsByZoneID(), name='feeds-areaid'), + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?feeds/mapid/(?P<map_id>\d+)$', + LatestPOIsByZoneID(), name='feeds-mapid'), ) if hasattr(settings, 'CHIMERE_ENABLE_ROUTING') \ @@ -59,7 +59,7 @@ if hasattr(settings, 'CHIMERE_ENABLE_ROUTING') \ raise ImproperlyConfigured(u"CHIMERE_ROUTING_TRANSPORT must be set in"\ u" settings if you enable routing") urlpatterns += patterns('chimere.views', - url(r'^(?P<area_name>[a-zA-Z0-9_-]*/)?route/'\ + url(r'^(?P<map_name>[a-zA-Z0-9_-]*/)?route/'\ r'(?P<transport>(%s))/((?P<speed>[0-9][0-9]*)/)?' r'(?P<lon1>[-]?[0-9]+[.]?[0-9]*)_(?P<lat1>[-]?[0-9]+[.]?[0-9]*)_'\ r'(?P<lonlat_steps>([-]?[0-9]+[.]?[0-9]*_[-]?[0-9]+[.]?[0-9]*_)*)'\ @@ -68,41 +68,60 @@ if hasattr(settings, 'CHIMERE_ENABLE_ROUTING') \ 'route', name="route"), ) +if hasattr(settings, 'CHIMERE_SEARCH_ENGINE') \ + and settings.CHIMERE_SEARCH_ENGINE: + from chimere.forms import SearchForm + from chimere.views import SearchView + from haystack.views import search_view_factory + urlpatterns += patterns('chimere.views', + url(r'^search/?$', search_view_factory( + view_class=SearchView, + template='search/search.html', + form_class=SearchForm + ), name='haystack_search'), + url(r'^search/autocomplete/$', 'autocomplete', + name='autocomplete-search') + ) + #urlpatterns += [url(r'^search/', include('haystack.urls')),] + urlpatterns += patterns('chimere.views', + url(r'^logout/?$', 'logout_view', name="logout"), url(r'^charte/?$', 'charte', name="charte"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?contact/?$', 'contactus', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?contact/?$', 'contactus', name="contact"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit/$', 'edit', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?edit/$', 'edit', name="edit"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit/(?P<item_id>\w+)/(?P<submited>\w+)?$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?edit/(?P<item_id>\w+)/(?P<submited>\w+)?$', 'edit', name="edit-item"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-route/$', 'editRoute', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?edit-route/$', 'editRoute', name="editroute"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?edit-route/(?P<item_id>\w+)/(?P<submited>\w+)?$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?edit-route/(?P<item_id>\w+)/(?P<submited>\w+)?$', 'editRoute', name="editroute-item"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getDetail/(?P<marker_id>\d+)/?$', 'getDetail', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?getDetail/(?P<marker_id>\d+)/?$', 'getDetail', name="get_detail"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getDescriptionDetail/?(?P<category_id>\d+)/?$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?getDescriptionDetail/?(?P<category_id>\d+)/?$', 'getDescriptionDetail', name="get_description_detail"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getGeoObjects/'\ + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?getGeoObjects/'\ r'(?P<category_ids>[a-zA-Z0-9_-]+)(/(?P<status>\w+))?$', 'getGeoObjects', name="getgeoobjects"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getAvailableCategories/$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?getAvailableCategories/$', 'get_available_categories', name="get_categories"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getAllCategories/$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?getAllCategories/$', 'get_all_categories', name="get_all_categories"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?getCategory/(?P<category_id>\d+)/?$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?getCategory/(?P<category_id>\d+)/?$', 'getCategory', name="get_category"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]*/)?get-share-url/(?P<network>\w+)?$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]*/)?get-share-url/(?P<network>\w+)?$', 'getShareUrl', name="get-share-url"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]*/)?ty/(?P<tiny_urn>\w+)$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]*/)?ty/(?P<tiny_urn>\w+)$', 'redirectFromTinyURN', name="tiny"), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?upload_file/((?P<category_id>\w+)/)?$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?upload_file/((?P<category_id>\w+)/)?$', 'uploadFile', name='upload_file'), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?process_route_file/(?P<file_id>\d+)/$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?process_route_file/(?P<file_id>\d+)/$', 'processRouteFile', name='process_route_file'), - url(r'^(?P<area_name>[a-zA-Z0-9_-]+/)?dyn/(?P<page_id>\w+)/$', + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?dyn/(?P<page_id>\w+)/$', 'extraPage', name='extra_page'), + url(r'^(?P<map_name>[a-zA-Z0-9_-]+/)?json/(?P<app_name>[a-zA-Z0-9_-]+)/(?P<filename>[a-zA-Z0-9_-]+).json$', 'get_json', + name='get-json'), # At the end, because it catches large - url(r'^(?P<area_name>[a-zA-Z0-9_-]+)?', 'index', name="index"), + url(r'^(?P<map_name>[a-zA-Z0-9_-]+)?', 'index', name="index"), ) |