Ejemplo n.º 1
0
    def get_urlpatterns(self):
        urlpatterns = []

        for name, class_ in self._endpoints.items():
            pattern = url(r"^{}/".format(name), include(class_.get_urlpatterns(), namespace=name))
            urlpatterns.append(pattern)

        decorate_urlpatterns(urlpatterns, self.wrap_view)

        return urlpatterns
Ejemplo n.º 2
0
        # Add views for testing 404 and 500 templates
        path('test404/', TemplateView.as_view(template_name='404.html')),
        path('test500/', TemplateView.as_view(template_name='500.html')),
    ]

if settings.DEBUG or settings.ENABLE_STYLEGUIDE:
    urlpatterns += [
        # Add styleguide
        path('styleguide/', TemplateView.as_view(template_name='styleguide.html')),
    ]

urlpatterns += [
    path('', include(wagtail_urls)),
]


# Cache-control
cache_length = getattr(settings, 'CACHE_CONTROL_MAX_AGE', None)

if cache_length:
    urlpatterns = decorate_urlpatterns(
        urlpatterns,
        cache_control(max_age=cache_length)
    )

if settings.DEBUG and settings.DEBUGTOOLBAR:
    import debug_toolbar
    urlpatterns = [
        path('__debug__/', include(debug_toolbar.urls)),
    ] + urlpatterns
Ejemplo n.º 3
0
from wagtail.contrib.sitemaps.views import sitemap
from wagtail.core import urls as wagtail_urls
from wagtail.core.models import Page
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.utils.urlpatterns import decorate_urlpatterns
from wagtail_review import urls as wagtailreview_urls

from tbx.core import urls as torchbox_urls
from tbx.core.utils.cache import get_default_cache_control_decorator
from tbx.core.views import favicon, robots

private_urlpatterns = [
    path('django-admin/', admin.site.urls),
    path('admin/', include(wagtailadmin_urls)),
] + decorate_urlpatterns([
    path('documents/', include(wagtaildocs_urls)),
], never_cache)

urlpatterns = [
    path('sitemap.xml', sitemap),
    path('favicon.ico', favicon),
    path('robots.txt', robots),
]

if settings.DEBUG:
    from django.conf.urls.static import static
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.views.generic import TemplateView

    # Serve static and media files from development server
    urlpatterns += staticfiles_urlpatterns()
Ejemplo n.º 4
0
        account.current_time_zone,
        name='wagtailadmin_account_current_time_zone'
    ),
    url(r'^logout/$', account.LogoutView.as_view(), name='wagtailadmin_logout'),
]


# Import additional urlpatterns from any apps that define a register_admin_urls hook
for fn in hooks.get_hooks('register_admin_urls'):
    urls = fn()
    if urls:
        urlpatterns += urls


# Add "wagtailadmin.access_admin" permission check
urlpatterns = decorate_urlpatterns(urlpatterns, require_admin_access)


# These url patterns do not require an authenticated admin user
urlpatterns += [
    url(r'^login/$', account.LoginView.as_view(), name='wagtailadmin_login'),

    # These two URLs have the "permission_required" decorator applied directly
    # as they need to fail with a 403 error rather than redirect to the login page
    url(r'^userbar/(\d+)/$', userbar.for_frontend, name='wagtailadmin_userbar_frontend'),
    url(r'^userbar/moderation/(\d+)/$', userbar.for_moderation, name='wagtailadmin_userbar_moderation'),

    # Password reset
    url(r'^password_reset/', include(wagtailadmin_password_reset_urls)),

    # Default view (will show 404 page)
Ejemplo n.º 5
0
 def get_urlpatterns(self):
     return decorate_urlpatterns([
         url(r'^%s/' % name, include(endpoint.get_urlpatterns(), namespace=name))
         for name, endpoint in self.endpoints.items()
     ], self.api_view)
Ejemplo n.º 6
0
        account.current_time_zone,
        name='wagtailadmin_account_current_time_zone'
    ),
    url(r'^logout/$', account.LogoutView.as_view(), name='wagtailadmin_logout'),
]


# Import additional urlpatterns from any apps that define a register_admin_urls hook
for fn in hooks.get_hooks('register_admin_urls'):
    urls = fn()
    if urls:
        urlpatterns += urls


# Add "wagtailadmin.access_admin" permission check
urlpatterns = decorate_urlpatterns(urlpatterns, require_admin_access)


# These url patterns do not require an authenticated admin user
urlpatterns += [
    url(r'^login/$', account.LoginView.as_view(), name='wagtailadmin_login'),

    # These two URLs have the "permission_required" decorator applied directly
    # as they need to fail with a 403 error rather than redirect to the login page
    url(r'^userbar/(\d+)/$', userbar.for_frontend, name='wagtailadmin_userbar_frontend'),
    url(r'^userbar/moderation/(\d+)/$', userbar.for_moderation, name='wagtailadmin_userbar_moderation'),

    # Password reset
    url(r'^password_reset/', include(wagtailadmin_password_reset_urls)),

    # Default view (will show 404 page)
Ejemplo n.º 7
0
        urlpatterns = [path("__debug__/", include(debug_toolbar.urls))
                       ] + urlpatterns

# Style guide
if getattr(settings, "PATTERN_LIBRARY_ENABLED",
           False) and apps.is_installed("pattern_library"):
    from vuecodingchallenge.project_styleguide.views import example_form

    private_urlpatterns += [
        path("pattern-library/example-form/", example_form),
        path("pattern-library/", include("pattern_library.urls")),
    ]

# Set public URLs to use the "default" cache settings.
urlpatterns = decorate_urlpatterns(urlpatterns,
                                   get_default_cache_control_decorator())

# Set vary header to instruct cache to serve different version on different
# cookies, different request method (e.g. AJAX) and different protocol
# (http vs https).
urlpatterns = decorate_urlpatterns(
    urlpatterns,
    vary_on_headers("Cookie", "X-Requested-With", "X-Forwarded-Proto",
                    "Accept-Encoding"),
)

# Join private and public URLs.
urlpatterns = (
    private_urlpatterns + urlpatterns + [
        # Add Wagtail URLs at the end.
        # Wagtail cache-control is set on the page models's serve methods.
        account.language_preferences,
        name='wagtailadmin_account_language_preferences'
    ),
    url(r'^logout/$', account.logout, name='wagtailadmin_logout'),
]


# Import additional urlpatterns from any apps that define a register_admin_urls hook
for fn in hooks.get_hooks('register_admin_urls'):
    urls = fn()
    if urls:
        urlpatterns += urls


# Add "wagtailadmin.access_admin" permission check
urlpatterns = decorate_urlpatterns(urlpatterns, require_admin_access)


# These url patterns do not require an authenticated admin user
urlpatterns += [
    url(r'^login/$', account.login, name='wagtailadmin_login'),

    # These two URLs have the "permission_required" decorator applied directly
    # as they need to fail with a 403 error rather than redirect to the login page
    url(r'^userbar/(\d+)/$', userbar.for_frontend, name='wagtailadmin_userbar_frontend'),
    url(r'^userbar/moderation/(\d+)/$', userbar.for_moderation, name='wagtailadmin_userbar_moderation'),

    # Password reset
    url(r'^password_reset/', include(wagtailadmin_password_reset_urls)),

    # Default view (will show 404 page)
Ejemplo n.º 9
0
    url(r'^home-more/$', views.home_more, name='home_more'),
    url(
        r'^reaction/(?P<article_slug>[0-9A-Za-z_\-]+)/'
        r'(?P<question_id>\d+)/vote/$',
        views.ReactionQuestionChoiceView.as_view(),
        name='reaction-vote'),
    url(
        r'^reaction/(?P<article_slug>[0-9A-Za-z_\-]+)/'
        r'(?P<question_id>\d+)/(?P<choice_slug>[0-9A-Za-z_\-]+)/feedback/$',
        views.ReactionQuestionChoiceFeedbackView.as_view(),
        name='reaction-feedback'),
    url(r'^api/',
        include(('molo.core.api.urls', 'molo.api'), namespace='molo_api')),
    url(
        r'^api/v2/',
        include((decorate_urlpatterns(api_router.get_urlpatterns(),
                                      never_cache), 'molo.api'),
                namespace=api_router.url_namespace)),
    url(r'^versions/$', views.versions, name='versions'),
    url(r'^djga/', include('google_analytics.urls')),
    url(r'^tags/(?P<tag_name>[\w-]+)/$',
        views.TagsListView.as_view(),
        name='tags_list'),
    url(r'^(\d+)/publish/$', views.publish, name='publish'),
    url(r'^(\d+)/copy_to_all_confirm/$',
        views.copy_to_all_confirm,
        name='copy-to-all-confirm'),
    url(r'^(\d+)/copy_to_all/$', views.copy_to_all, name='copy-to-all'),
    url('', include('django_prometheus.urls')),
]
Ejemplo n.º 10
0
 def get_urlpatterns(self):
     return decorate_urlpatterns([
         url(r'^%s/' % name,
             include(endpoint.get_urlpatterns(), namespace=name))
         for name, endpoint in self.endpoints.items()
     ], self.api_view)
Ejemplo n.º 11
0
        name='wagtailadmin_account_change_password'),
    url(r'^account/notification_preferences/$',
        account.notification_preferences,
        name='wagtailadmin_account_notification_preferences'),
    url(r'^logout/$', account.logout, name='wagtailadmin_logout'),
]

# Import additional urlpatterns from any apps that define a register_admin_urls hook
for fn in hooks.get_hooks('register_admin_urls'):
    urls = fn()
    if urls:
        urlpatterns += urls

# Add "wagtailadmin.access_admin" permission check
urlpatterns = decorate_urlpatterns(
    urlpatterns,
    permission_required('wagtailadmin.access_admin',
                        login_url='wagtailadmin_login'))

# These url patterns do not require an authenticated admin user
urlpatterns += [
    url(r'^login/$', account.login, name='wagtailadmin_login'),

    # These two URLs have the "permission_required" decorator applied directly
    # as they need to fail with a 403 error rather than redirect to the login page
    url(r'^userbar/(\d+)/$',
        userbar.for_frontend,
        name='wagtailadmin_userbar_frontend'),
    url(r'^userbar/moderation/(\d+)/$',
        userbar.for_moderation,
        name='wagtailadmin_userbar_moderation'),
Ejemplo n.º 12
0
        ),
    ]

# Style guide
if getattr(settings, "PATTERN_LIBRARY_ENABLED",
           False) and apps.is_installed("pattern_library"):
    private_urlpatterns += [
        path("pattern-library/", include("pattern_library.urls")),
    ]

# Set vary header to instruct cache to serve different version on different
# cookies, different request method (e.g. AJAX) and different protocol
# (http vs https).
urlpatterns = decorate_urlpatterns(
    urlpatterns,
    vary_on_headers("Cookie", "X-Requested-With", "X-Forwarded-Proto",
                    "Accept-Encoding"),
)

# Join private and public URLs.
urlpatterns = (
    private_urlpatterns + urlpatterns + [
        # Add Wagtail URLs at the end.
        # Wagtail cache-control is set on the page models's serve methods.
        path("", include(wagtail_urls)),
    ])

# Error handlers
handler404 = "esite.utils.views.page_not_found"
handler500 = "esite.utils.views.server_error"
Ejemplo n.º 13
0
    urlpatterns += [
        # Add views for testing 404 and 500 templates
        path('test404/', TemplateView.as_view(template_name='404.html')),
        path('test500/', TemplateView.as_view(template_name='500.html')),
    ]

if settings.DEBUG or settings.ENABLE_STYLEGUIDE:
    urlpatterns += [
        # Add styleguide
        path('styleguide/',
             TemplateView.as_view(template_name='styleguide.html')),
    ]

# Set public URLs to use the "default" cache settings.
urlpatterns = decorate_urlpatterns(urlpatterns,
                                   get_default_cache_control_decorator())

# Set vary header to instruct cache to serve different version on different
# cookies, different request method (e.g. AJAX) and different protocol
# (http vs https).
urlpatterns = decorate_urlpatterns(
    urlpatterns,
    vary_on_headers('Cookie', 'X-Requested-With', 'X-Forwarded-Proto',
                    'Accept-Encoding'))

# Join private and public URLs.
urlpatterns = private_urlpatterns + urlpatterns + [
    # Add Wagtail URLs at the end.
    # Wagtail cache-control is set on the page models's serve methods.
    path('', include(wagtail_urls)),
]
Ejemplo n.º 14
0
from wagtail.contrib.sitemaps.views import sitemap
from wagtail.core import urls as wagtail_urls
from wagtail.core.models import Page
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.utils.urlpatterns import decorate_urlpatterns
from wagtail_review import urls as wagtailreview_urls

from tbx.core import urls as torchbox_urls
from tbx.core.utils.cache import get_default_cache_control_decorator
from tbx.core.views import robots

private_urlpatterns = [
    path('django-admin/', admin.site.urls),
    path('admin/', include(wagtailadmin_urls)),
] + decorate_urlpatterns([
    path('documents/', include(wagtaildocs_urls)),
], never_cache)

urlpatterns = [
    path('sitemap.xml', sitemap),
    path('robots.txt', robots),
]


if settings.DEBUG:
    from django.conf.urls.static import static
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.views.generic import TemplateView

    # Serve static and media files from development server
    urlpatterns += staticfiles_urlpatterns()
Ejemplo n.º 15
0
# Copyright © 2017 anfema GmbH. All rights reserved.
from django.urls import path

from wagtail.utils.urlpatterns import decorate_urlpatterns
from wagtail.admin.auth import require_admin_access

from wagtail_to_ion.views.wagtail_override import ion_unpublish, ion_publish_with_children

overridden_urlpatterns = [
    path('pages/<int:page_id>/unpublish/', ion_unpublish, name='unpublish'),
    path('pages/<int:page_id>/publish-with-children/',
         ion_publish_with_children,
         name='publish-with-children'),
]

urlpatterns = decorate_urlpatterns(overridden_urlpatterns,
                                   require_admin_access)
Ejemplo n.º 16
0
        name='wagtailadmin_account_change_password'),
    url(r'^account/notification_preferences/$',
        account.notification_preferences,
        name='wagtailadmin_account_notification_preferences'),
    url(r'^logout/$', account.logout, name='wagtailadmin_logout'),
]

# Import additional urlpatterns from any apps that define a register_admin_urls hook
for fn in hooks.get_hooks('register_admin_urls'):
    urls = fn()
    if urls:
        urlpatterns += urls

# Add "wagtailadmin.access_admin" permission check
urlpatterns = decorate_urlpatterns(
    urlpatterns,
    permission_required('wagtailadmin.access_admin',
                        login_url='wagtailadmin_login'))

# These url patterns do not require an authenticated admin user
urlpatterns += [
    url(r'^login/$', account.login, name='wagtailadmin_login'),

    # These two URLs have the "permission_required" decorator applied directly
    # as they need to fail with a 403 error rather than redirect to the login page
    url(r'^userbar/(\d+)/$',
        userbar.for_frontend,
        name='wagtailadmin_userbar_frontend'),
    url(r'^userbar/moderation/(\d+)/$',
        userbar.for_moderation,
        name='wagtailadmin_userbar_moderation'),
Ejemplo n.º 17
0
urlpatterns = patterns(
    '',
    url(r'^django-admin/', include(admin.site.urls)),
    url(r'^admin/', include(wagtailadmin_urls)),
    url(r'^documents/', include(wagtaildocs_urls)),
    url(r'^images/', include(wagtailimages_urls)),
    url(r'^admin/donations/', include(donations_urls)),
    url(r'^admin/', include(rca_admin_urls)),
    url(r'^twitter/', include(twitter_urls)),
    url(r'^taxonomy/api/v1/$',
        never_cache(taxonomy_views.api),
        name='taxonomy_api_v0'),
    url(
        r'^api/v2/',
        include(decorate_urlpatterns(api_router.get_urlpatterns(),
                                     never_cache),
                namespace=api_router.url_namespace)),
    url(r'^search/$',
        'wagtail.wagtailsearch.views.search', {
            'template': 'rca/search_results.html',
            'template_ajax': 'rca/includes/search_listing.html',
        },
        name='wagtailsearch_search'),
    url(r'^search/suggest/$',
        'wagtail.wagtailsearch.views.search', {
            'use_json': True,
            'json_attrs': ['title', 'url', 'search_name', 'search_url']
        },
        name='wagtailsearch_suggest'),
    url(r'^my-rca/',
        include(student_profiles.urls, namespace='student-profiles')),
Ejemplo n.º 18
0
from wagtail.contrib.sitemaps.views import sitemap
from wagtail.core import urls as wagtail_urls
from wagtail.core.models import Page
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.utils.urlpatterns import decorate_urlpatterns
from wagtail_review import urls as wagtailreview_urls

from tbx.core import urls as torchbox_urls
from tbx.core.utils.cache import get_default_cache_control_decorator
from tbx.core.views import robots

private_urlpatterns = [
    path('django-admin/', admin.site.urls),
    path('admin/', include(wagtailadmin_urls)),
] + decorate_urlpatterns([
    path('documents/', include(wagtaildocs_urls)),
], never_cache)

urlpatterns = [
    path('sitemap.xml', sitemap),
    path('robots.txt', robots),
]

if settings.DEBUG:
    from django.conf.urls.static import static
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.views.generic import TemplateView

    # Serve static and media files from development server
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL,
Ejemplo n.º 19
0
    path("", include("social_django.urls", namespace="social")),
    re_path(r"^dashboard/", index, name="user-dashboard"),
    re_path(r"^receipt/(?P<pk>\d+)/", index, name="order-receipt"),
    re_path(r"^account-settings/", index, name="account-settings"),
    # Wagtail
    re_path(r"^cms/login",
            cms_signin_redirect_to_site_signin,
            name="wagtailadmin_login"),
    re_path(r"^cms/", include(wagtailadmin_urls)),
    re_path(r"^documents/", include(wagtaildocs_urls)),
] + decorate_urlpatterns(
    # NOTE: This route enables dynamic Wagtail image loading. It comes directly from the Wagtail docs:
    #       https://docs.wagtail.io/en/v2.7/advanced_topics/images/image_serve_view.html#setup
    [
        re_path(
            r"^images/([^/]*)/(\d*)/([^/]*)/[^/]*$",
            ServeView.as_view(),
            name="wagtailimages_serve",
        )
    ],
    cache_control(max_age=WAGTAIL_IMG_CACHE_AGE),
) + [
    path("", include(wagtail_urls)),
    # Add custom URL patterns that will also serve Wagtail pages
    path("", include("cms.urls")),
    path("robots.txt", include("robots.urls")),
] + (static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +
     static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)))

handler404 = not_found_handler
handler500 = server_error_handler
Ejemplo n.º 20
0
from wagtail.core import urls as wagtail_urls
from wagtail.core.models import Page
from wagtail.documents import urls as wagtaildocs_urls
from wagtail.utils.urlpatterns import decorate_urlpatterns

from tbx.core import urls as torchbox_urls
from tbx.core.utils.cache import get_default_cache_control_decorator
from tbx.core.views import robots

# from wagtail_review import urls as wagtailreview_urls


private_urlpatterns = [
    path("django-admin/", admin.site.urls),
    path("admin/", include(wagtailadmin_urls)),
] + decorate_urlpatterns([path("documents/", include(wagtaildocs_urls))], never_cache)

urlpatterns = [
    path("sitemap.xml", sitemap),
    path("robots.txt", robots),
]


if settings.DEBUG:
    from django.conf.urls.static import static
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    from django.views.generic import TemplateView

    # Serve static and media files from development server
    urlpatterns += staticfiles_urlpatterns()
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Ejemplo n.º 21
0
api_router = WagtailAPIRouter('wagtailapi_v2')
api_router.register_endpoint('pages', RCAPagesAPIEndpoint)
api_router.register_endpoint('images', RCAImagesAPIEndpoint)
api_router.register_endpoint('documents', DocumentsAPIEndpoint)


urlpatterns = patterns('',
    url(r'^django-admin/', include(admin.site.urls)),
    url(r'^admin/', include(wagtailadmin_urls)),
    url(r'^documents/', include(wagtaildocs_urls)),
    url(r'^images/', include(wagtailimages_urls)),
    url(r'^admin/donations/', include(donations_urls)),
    url(r'^admin/', include(rca_admin_urls)),
    url(r'^twitter/', include(twitter_urls)),
    url(r'^taxonomy/api/v1/$', never_cache(taxonomy_views.api), name='taxonomy_api_v0'),
    url(r'^api/v2/', include(decorate_urlpatterns(api_router.get_urlpatterns(), never_cache), namespace=api_router.url_namespace)),

    url(r'^search/$', 'wagtail.wagtailsearch.views.search', {
        'template': 'rca/search_results.html',
        'template_ajax': 'rca/includes/search_listing.html',
    }, name='wagtailsearch_search'),
    url(r'^search/suggest/$', 'wagtail.wagtailsearch.views.search', {
        'use_json': True,
        'json_attrs': ['title', 'url', 'search_name', 'search_url']
    }, name='wagtailsearch_suggest'),

    url(r'^my-rca/', include(student_profiles.urls, namespace='student-profiles')),
    url(r'^my-rca/nowpages/', include(student_profiles.now_urls, namespace='nowpages')),

    # For anything not caught by a more specific rule above, hand over to
    # Wagtail's serving mechanism
Ejemplo n.º 22
0
        account.notification_preferences,
        name='wagtailadmin_account_notification_preferences'
    ),
    url(r'^logout/$', account.logout, name='wagtailadmin_logout'),
]


# Import additional urlpatterns from any apps that define a register_admin_urls hook
for fn in hooks.get_hooks('register_admin_urls'):
    urls = fn()
    if urls:
        urlpatterns += urls


# Add "wagtailadmin.access_admin" permission check
urlpatterns = decorate_urlpatterns(urlpatterns, require_admin_access)


# These url patterns do not require an authenticated admin user
urlpatterns += [
    url(r'^login/$', account.login, name='wagtailadmin_login'),

    # These two URLs have the "permission_required" decorator applied directly
    # as they need to fail with a 403 error rather than redirect to the login page
    url(r'^userbar/(\d+)/$', userbar.for_frontend, name='wagtailadmin_userbar_frontend'),
    url(r'^userbar/moderation/(\d+)/$', userbar.for_moderation, name='wagtailadmin_userbar_moderation'),

    # Password reset
    url(r'^password_reset/', include(wagtailadmin_password_reset_urls)),
]
Ejemplo n.º 23
0
"""
RCA Now blog posts, kept as separate URL config for easier enabling/disabling
and for allowing more customization
"""

from django.conf.urls import patterns, url
from django.views.decorators.cache import never_cache

from wagtail.utils.urlpatterns import decorate_urlpatterns

from .now_views import overview, edit, preview, submit, delete
from .now_views import image_upload

urlpatterns = patterns(
    '',

    url(r'^$', overview, name='overview'),
    url(r'^(?P<page_id>\d+)/preview/$', preview, name='preview'),
    url(r'^(?P<page_id>\d+)/submit/$', submit, name='submit'),

    url(r'^new/$', edit, name='create'),

    url(r'^(?P<page_id>\d+)/edit/$', edit, name='edit'),
    url(r'^(?P<page_id>\d+)/delete/$', delete, name='delete'),

    url(r'^(?P<page_id>\d+)/edit/image/$', image_upload),
    url(r'^new/image/$', image_upload),
)

urlpatterns = decorate_urlpatterns(urlpatterns, never_cache)
Ejemplo n.º 24
0
        name='home_more'
    ),
    url(r'^reaction/(?P<article_slug>[0-9A-Za-z_\-]+)/'
        r'(?P<question_id>\d+)/vote/$',
        views.ReactionQuestionChoiceView.as_view(),
        name='reaction-vote'),
    url(r'^reaction/(?P<article_slug>[0-9A-Za-z_\-]+)/'
        r'(?P<question_id>\d+)/(?P<choice_slug>[0-9A-Za-z_\-]+)/feedback/$',
        views.ReactionQuestionChoiceFeedbackView.as_view(),
        name='reaction-feedback'),

    url(r'^api/', include(
        'molo.core.api.urls', namespace='molo_api', app_name='molo.api')),

    url(r'^api/v2/', include(
        decorate_urlpatterns(api_router.get_urlpatterns(), never_cache),
        namespace=api_router.url_namespace, app_name='molo.api'
    )),
    url(
        r'^versions/$',
        views.versions,
        name='versions'),
    url(r'^djga/', include('google_analytics.urls')),
    url(
        r'^tags/(?P<tag_name>[\w-]+)/$',
        views.TagsListView.as_view(),
        name='tags_list'
    ),
    url(r'^(\d+)/publish/$', views.publish, name='publish'),
    url(
        r'^(\d+)/copy_to_all_confirm/$',
Ejemplo n.º 25
0
from django.conf.urls import url, include
from django.views.decorators.cache import never_cache

from rai.views import HomeView

from wagtail.admin.decorators import require_admin_access
from wagtail.core import hooks
from wagtail.utils.urlpatterns import decorate_urlpatterns

urlpatterns = [
    url(r'^$', HomeView.as_view(), name='rai_home'),
]

# Import additional urlpatterns from any apps that define a register_rai_urls hook
for fn in hooks.get_hooks('register_rai_url'):
    urls = fn()
    if urls:
        urlpatterns += urls

urlpatterns = decorate_urlpatterns(urlpatterns, require_admin_access)


Ejemplo n.º 26
0
    url(r'^account/notification_preferences/$', account.notification_preferences, name='wagtailadmin_account_notification_preferences'),
    url(r'^logout/$', account.logout, name='wagtailadmin_logout'),
]


# Import additional urlpatterns from any apps that define a register_admin_urls hook
for fn in hooks.get_hooks('register_admin_urls'):
    urls = fn()
    if urls:
        urlpatterns += urls


# Add "wagtailadmin.access_admin" permission check
urlpatterns = decorate_urlpatterns(urlpatterns,
    permission_required(
        'wagtailadmin.access_admin',
        login_url='wagtailadmin_login'
    )
)


# These url patterns do not require an authenticated admin user
urlpatterns += [
    url(r'^login/$', account.login, name='wagtailadmin_login'),

    # These two URLs have the "permission_required" decorator applied directly
    # as they need to fail with a 403 error rather than redirect to the login page
    url(r'^userbar/(\d+)/$', userbar.for_frontend, name='wagtailadmin_userbar_frontend'),
    url(r'^userbar/moderation/(\d+)/$', userbar.for_moderation, name='wagtailadmin_userbar_moderation'),

    # Password reset
    url(
Ejemplo n.º 27
0
from wagtail.utils.urlpatterns import decorate_urlpatterns

from tmknorg.home.views import FaviconView, PGPKeyView, SSHKeyView

frontendcache = cache_control(
    public=True,
    s_maxage=int(
        getattr(settings, 'FRONTEND_CACHE_CONTROL_S_MAXAGE', 24 * 60 * 60)),
    stale_while_revalidate=int(
        getattr(settings, 'FRONTEND_CACHE_CONTROL_STALE_WHILE_REVALIDATE',
                30)),
)

urlpatterns = decorate_urlpatterns([
    path('id_rsa.pub', SSHKeyView.as_view(), name='ssh-key'),
    path('public.asc', PGPKeyView.as_view(), name='pgp-key'),
    path('favicon.ico', FaviconView.as_view(), name='favicon'),
    path('sitemap.xml', sitemap),
], frontendcache)

if settings.DEBUG:
    urlpatterns += [
        re_path(r'^media/(?P<path>.*)$', serve, {
            'document_root': settings.MEDIA_ROOT,
        }),
    ]

urlpatterns = chain(urlpatterns, [
    path('cms/', include(wagtailadmin_urls)),
    path('documents/', include(wagtaildocs_urls)),
    path('', include(wagtail_urls)),
])