2013-10-08 19:37:22 +00:00
|
|
|
from django.conf.urls.defaults import *
|
|
|
|
from django.core.urlresolvers import reverse
|
2016-04-07 18:26:45 +00:00
|
|
|
#from django.views.generic.simple import direct_to_template
|
|
|
|
from django.views.generic.base import TemplateView
|
2013-11-28 03:14:52 +00:00
|
|
|
from django.contrib.auth.decorators import login_required
|
2013-12-16 20:16:34 +00:00
|
|
|
from . import views, models, forms
|
|
|
|
from .views import superlogin, CustomRegistrationView
|
2013-10-08 19:37:22 +00:00
|
|
|
|
2016-04-07 18:26:45 +00:00
|
|
|
# class to reproduce django 1.4 funtionality
|
|
|
|
class ExtraContextTemplateView(TemplateView):
|
|
|
|
extra_context = None
|
|
|
|
def get_context_data(self, **kwargs):
|
|
|
|
context = super(self.__class__, self).get_context_data(**kwargs)
|
|
|
|
if self.extra_context is not None:
|
|
|
|
for key, value in self.extra_context.items():
|
|
|
|
if callable(value):
|
|
|
|
context[key] = value()
|
|
|
|
else:
|
|
|
|
context[key] = value
|
|
|
|
return context
|
|
|
|
|
2013-10-08 19:37:22 +00:00
|
|
|
urlpatterns = patterns(
|
|
|
|
"",
|
2013-11-28 03:14:52 +00:00
|
|
|
url(r"^libraryauth/(?P<library_id>\d+)/join/$", views.join_library, name="join_library"),
|
2016-04-07 18:26:45 +00:00
|
|
|
url(r"^libraryauth/(?P<library_id>\d+)/deny/$", TemplateView.as_view(template_name='libraryauth/denied.html'), name="bad_library"),
|
2013-11-28 03:14:52 +00:00
|
|
|
url(r"^libraryauth/(?P<library_id>\d+)/users/$", views.library, {'template':'libraryauth/users.html'}, name="library_users"),
|
|
|
|
url(r"^libraryauth/(?P<library_id>\d+)/admin/$", login_required(views.UpdateLibraryView.as_view()), name="library_admin"),
|
|
|
|
url(r"^libraryauth/(?P<library_id>\d+)/login/$", views.login_as_library, name="library_login"),
|
|
|
|
url(r"^libraryauth/create/$", login_required(views.CreateLibraryView.as_view()), name="library_create"),
|
2016-04-07 18:26:45 +00:00
|
|
|
url(r"^libraryauth/list/$", ExtraContextTemplateView.as_view(
|
|
|
|
template_name='libraryauth/list.html',
|
|
|
|
extra_context={'libraries_to_show':'approved'}
|
|
|
|
), name="library_list"),
|
|
|
|
url(r"^libraryauth/unapproved/$", ExtraContextTemplateView.as_view(
|
|
|
|
template_name='libraryauth/list.html',
|
|
|
|
extra_context={'libraries_to_show':'new'}
|
|
|
|
), name="new_libraries"),
|
2013-12-16 20:16:34 +00:00
|
|
|
url(r'^accounts/register/$', CustomRegistrationView.as_view(), name='registration_register'),
|
2013-10-11 21:24:06 +00:00
|
|
|
url(r'^accounts/superlogin/$', views.superlogin, name='superlogin'),
|
2016-04-07 18:26:45 +00:00
|
|
|
url(r"^accounts/superlogin/welcome/$", ExtraContextTemplateView.as_view(
|
|
|
|
template_name='registration/welcome.html',
|
|
|
|
extra_context={'suppress_search_box': True,}
|
|
|
|
) ),
|
2013-12-16 20:16:34 +00:00
|
|
|
url(r'^accounts/login/pledge/$',superlogin,
|
|
|
|
{'template_name': 'registration/from_pledge.html'}),
|
|
|
|
url(r'^accounts/login/purchase/$',superlogin,
|
|
|
|
{'template_name': 'registration/from_purchase.html'}),
|
|
|
|
url(r'^accounts/login/add/$',superlogin,
|
|
|
|
{'template_name': 'registration/from_add.html'}),
|
|
|
|
url(r'^accounts/activate/complete/$',superlogin,
|
|
|
|
{'template_name': 'registration/activation_complete.html'}),
|
|
|
|
url(r'^accounts/login-error/$',superlogin,
|
|
|
|
{'template_name': 'registration/from_error.html'}),
|
|
|
|
url(r'^accounts/edit/$', 'regluit.frontend.views.edit_user'),
|
2016-04-07 18:26:45 +00:00
|
|
|
url(r"^accounts/login/welcome/$", ExtraContextTemplateView.as_view(
|
|
|
|
template_name='registration/welcome.html',
|
|
|
|
extra_context={'suppress_search_box': True,}
|
|
|
|
) ),
|
2015-04-08 02:55:30 +00:00
|
|
|
url(r'^socialauth/', include('social.apps.django_app.urls', namespace='social')),
|
2013-12-16 20:16:34 +00:00
|
|
|
url('accounts/', include('email_change.urls')),
|
|
|
|
url(r'^accounts/', include('registration.backends.default.urls')),
|
|
|
|
)
|