2012-04-28 18:16:05 +02:00
|
|
|
from django.conf.urls.defaults import url, patterns, include
|
2012-06-03 09:43:49 +02:00
|
|
|
from django.contrib.auth.decorators import user_passes_test
|
2012-08-08 10:46:36 +02:00
|
|
|
from django.contrib.auth.views import logout
|
|
|
|
from django.views.generic import RedirectView
|
2012-06-03 09:43:49 +02:00
|
|
|
|
2012-06-12 15:27:28 +02:00
|
|
|
from djcelery.views import apply as apply_task
|
2012-06-03 09:43:49 +02:00
|
|
|
from djeuscan.views import registered_tasks
|
|
|
|
|
2012-05-13 14:09:22 +02:00
|
|
|
from djeuscan.feeds import PackageFeed, CategoryFeed, HerdFeed, \
|
|
|
|
MaintainerFeed, GlobalFeed
|
2011-08-25 15:39:54 +02:00
|
|
|
|
2012-06-03 09:43:49 +02:00
|
|
|
|
|
|
|
admin_required = user_passes_test(lambda u: u.is_superuser)
|
|
|
|
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
package_patterns = patterns('djeuscan.views',
|
2012-04-28 18:16:05 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/feed/$',
|
|
|
|
PackageFeed(), name='package_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/$',
|
|
|
|
'package', name="package"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/favourite/$',
|
2012-06-12 15:27:28 +02:00
|
|
|
'favourite_package', name="favourite_package"),
|
2012-06-14 10:03:49 +02:00
|
|
|
url((r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/'
|
2012-07-10 16:15:06 +02:00
|
|
|
'unfavourite/$'), 'unfavourite_package', name="unfavourite_package"),
|
2012-07-07 15:44:00 +02:00
|
|
|
url((r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/'
|
|
|
|
'refresh$'), "refresh_package", name="refresh_package"),
|
2012-07-25 16:52:10 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/problem$',
|
|
|
|
'problem', name="problem"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
categories_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(view/)?$', 'category',
|
|
|
|
name="category"),
|
2012-04-28 18:16:05 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/feed/$', CategoryFeed(),
|
|
|
|
name='category_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/charts/(?P<chart>[\w\-]+).png$',
|
|
|
|
'chart_category', name="chart_category"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/favourite/$',
|
2012-06-12 15:27:28 +02:00
|
|
|
'favourite_category', name="favourite_category"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/unfavourite/$',
|
2012-06-14 10:03:49 +02:00
|
|
|
'unfavourite_category', name="unfavourite_category"),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^$', 'categories', name="categories"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
herds_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/(view/)?$', 'herd', name="herd"),
|
2011-08-26 13:27:46 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/feed/$', HerdFeed(), name='herd_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/charts/(?P<chart>[\w\-]+).png$',
|
|
|
|
'chart_herd', name="chart_herd"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/favourite/$', 'favourite_herd',
|
2012-06-12 15:27:28 +02:00
|
|
|
name="favourite_herd"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/unfavourite/$', 'unfavourite_herd',
|
2012-06-14 10:03:49 +02:00
|
|
|
name="unfavourite_herd"),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^$', 'herds', name="herds"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
maintainers_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/(view/)?$', 'maintainer', name="maintainer"),
|
2012-04-28 18:16:05 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/feed/$', MaintainerFeed(),
|
|
|
|
name='maintainer_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/charts/(?P<chart>[\w\-]+).png$',
|
|
|
|
'chart_maintainer', name="chart_maintainer"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/favourite/$',
|
2012-06-12 15:27:28 +02:00
|
|
|
'favourite_maintainer', name="favourite_maintainer"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/unfavourite/$',
|
2012-06-14 10:03:49 +02:00
|
|
|
'unfavourite_maintainer', name="unfavourite_maintainer"),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^$', 'maintainers', name="maintainers"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
2011-04-13 08:50:24 +02:00
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
overlays_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<overlay>[\w+][\w+.-]*)/(view/)?$', 'overlay', name="overlay"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^(?P<overlay>[\w+][\w+.-]*)/favourite/$', 'favourite_overlay',
|
|
|
|
name="favourite_overlay"),
|
|
|
|
url(r'^(?P<overlay>[\w+][\w+.-]*)/unfavourite/$', 'unfavourite_overlay',
|
|
|
|
name="unfavourite_overlay"),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^$', 'overlays', name="overlays"),
|
2011-11-23 18:03:07 +01:00
|
|
|
)
|
|
|
|
|
2012-06-08 14:21:11 +02:00
|
|
|
tasks_patterns = patterns('djeuscan.views',
|
2012-06-03 09:43:49 +02:00
|
|
|
url(r'^registered_tasks/$', admin_required(registered_tasks),
|
|
|
|
name="registered_tasks"),
|
2012-06-12 15:27:28 +02:00
|
|
|
url(r'^apply/(?P<task_name>.*)/$', admin_required(apply_task),
|
2012-06-03 09:43:49 +02:00
|
|
|
name="apply_task"),
|
|
|
|
)
|
|
|
|
|
2012-06-12 15:27:28 +02:00
|
|
|
accounts_patterns = patterns('djeuscan.views',
|
|
|
|
url(r'^profile/$', 'accounts_index', name="accounts_index"),
|
2012-08-08 10:46:36 +02:00
|
|
|
url(r'^profile/preferences/$', 'accounts_preferences',
|
|
|
|
name="accounts_preferences"),
|
2012-06-12 15:27:28 +02:00
|
|
|
url(r'^categories/$', 'accounts_categories', name="accounts_categories"),
|
|
|
|
url(r'^herds/$', 'accounts_herds', name="accounts_herds"),
|
|
|
|
url(r'^maintainers/$', 'accounts_maintainers',
|
|
|
|
name="accounts_maintainers"),
|
|
|
|
url(r'^packages/$', 'accounts_packages', name="accounts_packages"),
|
2012-07-10 16:15:06 +02:00
|
|
|
url(r'^overlays/$', 'accounts_overlays', name="accounts_overlays"),
|
2012-08-08 10:46:36 +02:00
|
|
|
|
|
|
|
url(r'^logout/$', logout, {'next_page': '/'}),
|
|
|
|
|
|
|
|
url(r'^password/change/done/$',
|
|
|
|
RedirectView.as_view(url="../../../profile/")),
|
2012-06-12 15:27:28 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
urlpatterns = patterns('djeuscan.views',
|
2011-11-15 17:08:29 +01:00
|
|
|
# Global stuff
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^api/', include('djeuscan.api.urls')),
|
2012-04-04 17:31:54 +02:00
|
|
|
|
2012-05-01 16:56:09 +02:00
|
|
|
url(r'^$', 'index', name="index"),
|
2011-08-25 15:39:54 +02:00
|
|
|
url(r'^feed/$', GlobalFeed(), name='global_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^about/$', 'about', name="about"),
|
|
|
|
url(r'^about/api$', 'api', name="api"),
|
|
|
|
url(r'^statistics/$', 'statistics', name="statistics"),
|
|
|
|
url(r'^statistics/charts/(?P<chart>[\w\-]+).png$', 'chart', name="chart"),
|
|
|
|
url(r'^world/$', 'world', name="world"),
|
|
|
|
url(r'^world/scan/$', 'world_scan', name="world_scan"),
|
2011-11-15 17:08:29 +01:00
|
|
|
|
|
|
|
# Real data
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^categories/', include(categories_patterns)),
|
|
|
|
url(r'^herds/', include(herds_patterns)),
|
|
|
|
url(r'^maintainers/', include(maintainers_patterns)),
|
|
|
|
url(r'^overlays/', include(overlays_patterns)),
|
|
|
|
url(r'^package/', include(package_patterns)),
|
2012-06-12 15:27:28 +02:00
|
|
|
|
2012-06-03 09:43:49 +02:00
|
|
|
url(r'^tasks/', include(tasks_patterns)),
|
2012-06-12 15:27:28 +02:00
|
|
|
url(r'^accounts/', include(accounts_patterns)),
|
2011-04-13 08:50:24 +02:00
|
|
|
)
|