Пример #1
0
 def _mount(self):
     from orun.urls import path, include
     from orun.apps import default_urls
     self._mounted = True
     self.urlspatterns.insert(
         0, path('', include('orun.contrib.staticfiles.urls')))
     default_urls.urlpatterns = self.urlspatterns
Пример #2
0
from orun.urls import path, re_path

from . import views

app_name = 'admin'
urlpatterns = [
    path('web/', views.client.index),
    path('web/login/', views.client.login, name='login'),
    path('web/logout/', views.client.logout),
    path('web/js/templates/', views.client.js_templates),
    path('web/content/<int:content_id>/', views.client.content),
    path('web/content/upload/', views.client.upload_attachment),
    path('web/file/upload/<model>/<meth>/', views.client.upload_file),
    path('web/data/reorder/', views.client.reorder),
    path('web/image/<model>/<field>/<id>/', views.client.image),
    path('web/company/logo/', views.client.company_logo),
    path('web/reports/<path:path>', views.client.report),
    path('web/menu/search/', views.client.search_menu),
    # path('web/test/', views.test.qunit),
    path('api/rpc/<service>/<meth>/', views.api.rpc),
    path('api/view/<service>/', views.api.view),
    path('api/dashboard/<int:service>/', views.dashboard.index),
    path('api/dashboard/<service>/', views.dashboard.index),
    path('api/dashboard/<service>/<method>/', views.dashboard.rpc),
    path('api/field/choices/<service>/<field>/', views.api.choices),
    path('api/app/settings/', views.api.app_settings),
    path('api/public/query/<int:id>/', views.api.public_query),
]
Пример #3
0
from orun.urls import path, re_path

from . import views

urlpatterns = [
    path('pwa/', views.index),
    path('pwa/service-worker.js', views.service_worker_js),
    path('pwa/js/templates/', views.manifest_json),
    path('pwa/sync/', views.sync),
]
Пример #4
0
 def _app_config_ready(self, signal, sender: AppConfig, **kwargs):
     from orun.urls import path, include
     if not self._mounted:
         self._mount()
     if sender.urls_module:
         self.urlspatterns.append(path('', include(sender.urls_module)))
Пример #5
0
    This may only be used in the root URLconf, not in an included URLconf.
    """
    if not settings.USE_I18N:
        return list(urls)
    return [
        URLResolver(
            LocalePrefixPattern(
                prefix_default_language=prefix_default_language),
            list(urls),
        )
    ]


@functools.lru_cache(maxsize=None)
def is_language_prefix_patterns_used(urlconf):
    """
    Return a tuple of two booleans: (
        `True` if i18n_patterns() (LocalePrefixPattern) is used in the URLconf,
        `True` if the default language should be prefixed
    )
    """
    for url_pattern in get_resolver(urlconf).url_patterns:
        if isinstance(url_pattern.pattern, LocalePrefixPattern):
            return True, url_pattern.pattern.prefix_default_language
    return False, False


urlpatterns = [
    path('setlang/', set_language, name='set_language'),
]