2011-10-29 00:01:22 +04:00
|
|
|
from django import http
|
2009-12-31 01:26:56 +03:00
|
|
|
from django.conf.urls.defaults import patterns, url, include
|
|
|
|
from django.contrib import admin
|
|
|
|
from django.shortcuts import redirect
|
|
|
|
|
2011-10-03 20:49:23 +04:00
|
|
|
from addons.urls import ADDON_ID
|
2010-07-12 23:54:51 +04:00
|
|
|
from amo.urlresolvers import reverse
|
2009-12-31 01:43:25 +03:00
|
|
|
from . import views
|
|
|
|
|
2009-12-31 01:26:56 +03:00
|
|
|
|
|
|
|
urlpatterns = patterns('',
|
|
|
|
# AMO stuff.
|
2011-08-09 14:33:41 +04:00
|
|
|
url('^$', views.index, name='zadmin.index'),
|
|
|
|
url('^models$', lambda r: redirect('admin:index'), name='zadmin.home'),
|
2011-10-03 20:49:23 +04:00
|
|
|
url('^addon/manage/%s/$' % ADDON_ID,
|
|
|
|
views.addon_manage, name='zadmin.addon_manage'),
|
2011-10-05 21:44:16 +04:00
|
|
|
url('^addon/recalc-hash/(?P<file_id>\d+)/', views.recalc_hash,
|
|
|
|
name='zadmin.recalc_hash'),
|
2010-03-25 01:52:02 +03:00
|
|
|
url('^env$', views.env, name='amo.env'),
|
2010-04-14 02:59:28 +04:00
|
|
|
url('^flagged', views.flagged, name='zadmin.flagged'),
|
2010-06-30 02:28:40 +04:00
|
|
|
url('^hera', views.hera, name='zadmin.hera'),
|
2012-01-04 02:00:49 +04:00
|
|
|
url('^memcache$', views.memcache, name='zadmin.memcache'),
|
2010-04-14 02:59:28 +04:00
|
|
|
url('^settings', views.settings, name='zadmin.settings'),
|
2011-03-03 05:25:38 +03:00
|
|
|
url('^fix-disabled', views.fix_disabled_file, name='zadmin.fix-disabled'),
|
2011-04-27 00:07:59 +04:00
|
|
|
url(r'^validation/application_versions\.json$',
|
|
|
|
views.application_versions_json,
|
|
|
|
name='zadmin.application_versions_json'),
|
|
|
|
url(r'^validation/start$', views.start_validation,
|
|
|
|
name='zadmin.start_validation'),
|
2011-05-28 09:50:27 +04:00
|
|
|
url(r'^validation/job-status\.json$', views.job_status,
|
|
|
|
name='zadmin.job_status'),
|
2011-05-09 23:40:16 +04:00
|
|
|
url(r'^validation/set/(?P<job>\d+)$', views.notify_success,
|
|
|
|
name='zadmin.notify.success'),
|
|
|
|
url(r'^validation/notify/(?P<job>\d+)$', views.notify_failure,
|
|
|
|
name='zadmin.notify.failure'),
|
2011-05-04 22:56:44 +04:00
|
|
|
url(r'^validation/notify/syntax.json$', views.notify_syntax,
|
|
|
|
name='zadmin.notify.syntax'),
|
2011-07-01 01:47:51 +04:00
|
|
|
url(r'^validation/(?P<job_id>\d+)/tally\.csv$',
|
|
|
|
views.validation_tally_csv, name='zadmin.validation_tally_csv'),
|
2011-04-27 00:07:59 +04:00
|
|
|
url(r'^validation$', views.validation, name='zadmin.validation'),
|
2011-05-17 02:20:53 +04:00
|
|
|
url(r'^email_preview/(?P<topic>.*)\.csv$',
|
|
|
|
views.email_preview_csv, name='zadmin.email_preview_csv'),
|
2011-12-14 17:30:28 +04:00
|
|
|
url(r'^compat$', views.compat, name='zadmin.compat'),
|
2011-05-20 02:53:06 +04:00
|
|
|
url(r'^jetpack$', views.jetpack, name='zadmin.jetpack'),
|
2011-11-03 02:26:06 +04:00
|
|
|
url(r'^jetpack/resend/(?P<file_id>\d+)$', views.jetpack_resend,
|
|
|
|
name='zadmin.jetpack.resend'),
|
2011-06-13 22:55:36 +04:00
|
|
|
|
|
|
|
url('^features$', views.features, name='zadmin.features'),
|
|
|
|
url('^features/collections\.json$', views.es_collections_json,
|
|
|
|
name='zadmin.collections_json'),
|
|
|
|
url('^features/featured-collection$', views.featured_collection,
|
|
|
|
name='zadmin.featured_collection'),
|
2011-08-09 14:33:41 +04:00
|
|
|
|
|
|
|
url('^monthly-pick$', views.monthly_pick,
|
2011-08-01 23:44:26 +04:00
|
|
|
name='zadmin.monthly_pick'),
|
2011-08-09 14:33:41 +04:00
|
|
|
|
2011-05-26 00:38:11 +04:00
|
|
|
url('^elastic$', views.elastic, name='zadmin.elastic'),
|
|
|
|
url('^mail$', views.mail, name='zadmin.mail'),
|
2012-01-05 23:10:42 +04:00
|
|
|
url('^email-devs$', views.email_devs, name='zadmin.email_devs'),
|
2011-06-09 01:28:16 +04:00
|
|
|
url('^celery$', views.celery, name='zadmin.celery'),
|
2011-06-13 21:17:04 +04:00
|
|
|
url('^addon-name-blocklist$', views.addon_name_blocklist,
|
|
|
|
name='zadmin.addon-name-blocklist'),
|
2011-07-02 01:10:57 +04:00
|
|
|
url('^addon-search$', views.addon_search, name='zadmin.addon-search'),
|
2011-07-06 20:20:31 +04:00
|
|
|
url('^oauth-consumer-create$', views.oauth_consumer_create,
|
|
|
|
name='zadmin.oauth-consumer-create'),
|
2009-12-31 01:26:56 +03:00
|
|
|
|
2012-01-20 04:02:25 +04:00
|
|
|
# Site Event admin.
|
|
|
|
url('^events/(?P<event_id>\d+)?$', views.site_events,
|
|
|
|
name='zadmin.site_events'),
|
|
|
|
url('^events/(?P<event_id>\d+)/delete$', views.delete_site_event,
|
|
|
|
name='zadmin.site_events.delete'),
|
|
|
|
|
2009-12-31 01:26:56 +03:00
|
|
|
# The Django admin.
|
|
|
|
url('^models/', include(admin.site.urls)),
|
2011-07-26 13:39:42 +04:00
|
|
|
url('^models/(?P<app_id>.+)/(?P<model_id>.+)/search.json$',
|
|
|
|
views.general_search, name='zadmin.search'),
|
2009-12-31 01:26:56 +03:00
|
|
|
)
|
2010-07-12 23:54:51 +04:00
|
|
|
|
|
|
|
|
|
|
|
# Hijack the admin's login to use our pages.
|
|
|
|
def login(request):
|
2011-10-29 00:01:22 +04:00
|
|
|
# If someone is already auth'd then they're getting directed to login()
|
|
|
|
# because they don't have sufficient permissions.
|
|
|
|
if request.user.is_authenticated():
|
|
|
|
return http.HttpResponseForbidden()
|
|
|
|
else:
|
|
|
|
return redirect('%s?to=%s' % (reverse('users.login'), request.path))
|
2010-07-12 23:54:51 +04:00
|
|
|
|
|
|
|
|
|
|
|
admin.site.login = login
|