47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
from django.conf.urls.i18n import i18n_patterns
|
|
from django.urls import path
|
|
from django.views.decorators.cache import cache_page
|
|
|
|
from ocyan.core.fender import config
|
|
from ocyan.main.urls import urlpatterns as ocyan_urlpatterns
|
|
from ocyan.plugin.contact_form.entrypoint import SHOP_BASE_URL
|
|
from ocyan.plugin.wagtail_oscar_integration.constants import CACHE_DURATION
|
|
|
|
from contact_form.views import post_contact_form
|
|
|
|
from .i18n_views import set_language_normalized
|
|
from .sitemaps import robots_txt, sitemap_index, sitemap_section
|
|
|
|
urlpatterns = [
|
|
path("i18n/setlang/", set_language_normalized, name="set_language"),
|
|
path("robots.txt", robots_txt, name="robots-txt"),
|
|
path(
|
|
"sitemap.xml",
|
|
cache_page(CACHE_DURATION)(sitemap_index),
|
|
name="sitemap-index",
|
|
),
|
|
path(
|
|
"sitemap-<section>.xml",
|
|
cache_page(CACHE_DURATION)(sitemap_section),
|
|
name="sitemaps",
|
|
),
|
|
]
|
|
|
|
contact_form_urlpatterns = [
|
|
path(
|
|
f"{SHOP_BASE_URL}/contact-form/",
|
|
post_contact_form,
|
|
name="project-contact-form-handler",
|
|
),
|
|
]
|
|
|
|
if config.i18n_enabled:
|
|
urlpatterns += i18n_patterns(
|
|
*contact_form_urlpatterns,
|
|
prefix_default_language=False,
|
|
)
|
|
else:
|
|
urlpatterns += contact_form_urlpatterns
|
|
|
|
urlpatterns += ocyan_urlpatterns
|