regluit/frontend/urls.py

108 lines
7.4 KiB
Python
Raw Normal View History

from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.views.generic.base import TemplateView
from django.views.generic import ListView, DetailView
2011-10-29 22:40:00 +00:00
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.conf import settings
2013-01-21 15:33:08 +00:00
from django.contrib.sites.models import Site
from regluit.core.feeds import SupporterWishlistFeed
from regluit.core.models import Campaign
from regluit.frontend.views import GoodreadsDisplayView, LibraryThingView, PledgeView, PledgeCompleteView, PledgeCancelView, PledgeRechargeView, FAQView
2012-09-07 05:11:28 +00:00
from regluit.frontend.views import CampaignListView, WorkListView, UngluedListView, InfoPageView, InfoLangView, DonationView, FundPledgeView
from regluit.frontend.views import NonprofitCampaign, DonationCredit, PledgeModifiedView, ManageAccount, MergeView, ByPubListView
urlpatterns = patterns(
"regluit.frontend.views",
url(r"^$", "home", name="home"),
url(r"^landing/$", "home", {'landing': True}, name="landing"),
url(r"^next/$", "next", name="next"),
url(r"^supporter/(?P<supporter_username>[^/]+)/$", "supporter", {'template_name': 'supporter.html'}, name="supporter"),
2012-10-14 19:31:18 +00:00
url(r"^accounts/manage/$", login_required(ManageAccount.as_view()), name="manage_account"),
url(r"^search/$", "search", name="search"),
url(r"^privacy/$", TemplateView.as_view(template_name="privacy.html"),
name="privacy"),
2011-12-16 22:19:59 +00:00
url(r"^terms/$", TemplateView.as_view(template_name="terms.html"),
name="terms"),
url(r"^rightsholders/$", "rh_tools", name="rightsholders"),
url(r"^rightsholders/campaign/(?P<id>\d+)/$", "manage_campaign", name="manage_campaign"),
url(r"^rightsholders/edition/(?P<work_id>\d*)/(?P<edition_id>\d*)$", "new_edition",{'by': 'rh'}, name="rh_edition"),
2011-11-16 05:22:22 +00:00
url(r"^rightsholders/claim/$", "claim", name="claim"),
url(r"^rh_admin/$", "rh_admin", name="rh_admin"),
url(r"^campaign_admin/$", "campaign_admin", name="campaign_admin"),
2012-01-06 15:42:17 +00:00
url(r"^faq/$", FAQView.as_view(), {'location':'faq', 'sublocation':'all'}, name="faq"),
url(r"^faq/(?P<location>\w*)/$", FAQView.as_view(), {'sublocation':'all'}, name="faq_location"),
url(r"^faq/(?P<location>\w*)/(?P<sublocation>\w*)/$", FAQView.as_view(), name="faq_sublocation"),
url(r"^wishlist/$", "wishlist", name="wishlist"),
url(r"^campaigns/(?P<facet>\w*)$", CampaignListView.as_view(), name='campaign_list'),
url(r"^lists/(?P<facet>\w*)$", WorkListView.as_view(), name='work_list'),
url(r"^bypub/all/(?P<pubname>.*)$", ByPubListView.as_view(), name='bypub_list'),
url(r"^bypub/(?P<facet>\w*)/(?P<pubname>.*)$", ByPubListView.as_view(), name='bypub_list'),
2012-01-15 21:48:26 +00:00
url(r"^unglued/(?P<facet>\w*)$", UngluedListView.as_view(), name='unglued_list'),
url(r"^goodreads/auth/$", "goodreads_auth", name="goodreads_auth"),
url(r"^goodreads/auth_cb/$", "goodreads_cb", name="goodreads_cb"),
url(r"^goodreads/flush/$","goodreads_flush_assoc", name="goodreads_flush_assoc"),
url(r"^goodreads/load_shelf/$","goodreads_load_shelf", name="goodreads_load_shelf"),
url(r"^goodreads/shelves/$","goodreads_calc_shelves", name="goodreads_calc_shelves"),
url(r"^stub/", "stub", name="stub"),
2011-11-06 23:54:48 +00:00
url(r"^work/(?P<work_id>\d+)/$", "work", name="work"),
url(r"^work/(?P<work_id>\d+)/preview/$", "work", {'action': 'preview'}, name="work_preview"),
url(r"^work/(?P<work_id>\d+)/acks/$", "work", {'action': 'acks'}, name="work_acks"),
2012-08-15 13:40:37 +00:00
url(r"^work/(?P<work_id>\d+)/lockss/$", "lockss", name="lockss"),
url(r"^lockss/(?P<year>\d+)/$", "lockss_manifest", name="lockss_manifest"),
url(r"^work/(?P<work_id>\d+)/download/$", "download", name="download"),
url(r"^work/(?P<work_id>\d+)/merge/$", login_required(MergeView.as_view()), name="merge"),
url(r"^work/\d+/acks/images/(?P<file_name>[\w\.]*)$", "static_redirect_view",{'dir': 'images'}),
url(r"^work/(?P<work_id>\d+)/librarything/$", "work_librarything", name="work_librarything"),
url(r"^work/(?P<work_id>\d+)/goodreads/$", "work_goodreads", name="work_goodreads"),
url(r"^work/(?P<work_id>\d+)/openlibrary/$", "work_openlibrary", name="work_openlibrary"),
url(r"^new_edition/(?P<work_id>)(?P<edition_id>)$", "new_edition", name="new_edition"),
url(r"^new_edition/(?P<work_id>\d*)/(?P<edition_id>\d*)$", "new_edition", name="new_edition"),
url(r"^googlebooks/(?P<googlebooks_id>.+)/$", "googlebooks", name="googlebooks"),
url(r"^donation/$", login_required(DonationView.as_view()), name="donation"),
url(r"^donation/credit/(?P<token>.+)/$", login_required(DonationCredit.as_view()), name="donation_credit"),
2012-01-04 17:03:50 +00:00
url(r"^pledge/(?P<work_id>\d+)/$", login_required(PledgeView.as_view()), name="pledge"),
url(r"^pledge/cancel/(?P<campaign_id>\d+)$", login_required(PledgeCancelView.as_view()), name="pledge_cancel"),
url(r"^pledge/complete/$", login_required(PledgeCompleteView.as_view()), name="pledge_complete"),
url(r"^pledge/modified/$", login_required(PledgeModifiedView.as_view()), name="pledge_modified"),
url(r"^pledge/modify/(?P<work_id>\d+)$", login_required(PledgeView.as_view()), name="pledge_modify"),
url(r"^pledge/fund/(?P<t_id>\d+)$", login_required(FundPledgeView.as_view()), name="fund_pledge"),
2012-07-11 13:54:15 +00:00
url(r"^pledge/recharge/(?P<work_id>\d+)$", login_required(PledgeRechargeView.as_view()), name="pledge_recharge"),
url(r"^donate_to_campaign/$", csrf_exempt(NonprofitCampaign.as_view()), name="nonprofit"),
url(r"^subjects/$", "subjects", name="subjects"),
url(r"^librarything/$", LibraryThingView.as_view(), name="librarything"),
url(r"^librarything/load/$","librarything_load", name="librarything_load"),
2011-11-18 20:11:17 +00:00
url('^404testing/$', direct_to_template, {'template': '404.html'}),
url('^500testing/$', direct_to_template, {'template': '500.html'}),
2012-01-15 23:21:47 +00:00
url('^robots.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}),
url(r"^emailshare/(?P<action>\w*)/?$", "emailshare", name="emailshare"),
url(r"^feedback/$", "feedback", name="feedback"),
url(r"^feedback/thanks/$", TemplateView.as_view(template_name="thanks.html")),
2012-01-10 16:10:27 +00:00
url(r"^press/$", TemplateView.as_view(template_name="press.html"),
name="press"),
2012-01-15 18:19:35 +00:00
url(r"^about/$", TemplateView.as_view(template_name="about.html"),
name="about"),
2012-02-03 15:22:53 +00:00
url(r"^comments/$", "comment", name="comment"),
url(r"^info/(?P<template_name>[\w\.]*)$", InfoPageView.as_view()),
2012-07-20 18:29:04 +00:00
url(r"^info/languages/(?P<template_name>[\w\.]*)$", InfoLangView.as_view()),
url(r'^supporter/(?P<supporter>[^/]+)/feed/$', SupporterWishlistFeed()),
url(r'^campaign_archive.js/$', "campaign_archive_js", name="campaign_archive_js"),
url(r"^about/(?P<facet>\w*)/$", "about", name="about_specific"),
2013-01-21 15:33:08 +00:00
url(r"^libraries/$", TemplateView.as_view(
template_name="libraries.html",
get_context_data=lambda: {'site': Site.objects.get_current()}
),
name="libraries"),
url(r"^ml/status/$","ml_status", name="ml_status"),
url(r"^ml/subscribe/$","ml_subscribe", name="ml_subscribe"),
url(r"^ml/unsubscribe/$","ml_unsubscribe", name="ml_unsubscribe"),
)
2012-05-17 20:55:02 +00:00
if settings.DEBUG:
urlpatterns += patterns(
"regluit.frontend.views",
url(r"^goodreads/$", login_required(GoodreadsDisplayView.as_view()), name="goodreads_display"),
url(r"^goodreads/clear_wishlist/$","clear_wishlist", name="clear_wishlist"),
url(r"^celery/clear/$","clear_celery_tasks", name="clear_celery_tasks"),
)