Beispiel #1
0
def get_index():
    return None


def get_all_artists():
    return list(Artist.objects.values_list("slug", flat=True))


def get_all_releases():
    return list(Release.objects.values_list("slug", flat=True))


urlpatterns = [
    #     re_path(r'^/$', views.home, name='home'),
    distill_re_path(r"^artists/$",
                    views.artists,
                    name="artists",
                    distill_func=get_index),
    distill_re_path(
        r"^artists/(?P<slug>[\w-]+)/$",
        views.artist,
        name="artist",
        distill_func=get_all_artists,
    ),
    distill_re_path(r"^releases/$",
                    views.releases,
                    name="releases",
                    distill_func=get_index),
    distill_re_path(
        r"^releases/(?P<slug>[\w-]+)/$",
        views.release,
        name="release",
Beispiel #2
0
                name='url-positional-param',
                distill_func=test_positional_param_func),
    distill_url(r'^url/(?P<param>[\w]+)$',
                test_named_param_view,
                name='url-named-param',
                distill_func=test_named_param_func),
    path('path/namespace1/',
         include('tests.namespaced_urls', namespace='test_namespace')),
    path('path/no-namespace/', include('tests.no_namespaced_urls')),
]

if settings.HAS_RE_PATH:
    urlpatterns += [
        distill_re_path(r'^re_path/$',
                        test_no_param_view,
                        name='re_path-no-param',
                        distill_func=test_no_param_func,
                        distill_file='test'),
        distill_re_path(r'^re_path/([\d]+)$',
                        test_positional_param_view,
                        name='re_path-positional-param',
                        distill_func=test_positional_param_func),
        distill_re_path(r'^re_path/(?P<param>[\w]+)$',
                        test_named_param_view,
                        name='re_path-named-param',
                        distill_func=test_named_param_func),
        distill_re_path(r'^re_path/broken$',
                        test_broken_view,
                        name='re_path-broken',
                        distill_func=test_no_param_func),
        distill_re_path(r'^re_path/ignore-sessions$',
Beispiel #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from django.conf.urls import url
from django.views.decorators.cache import cache_page
from base import views
from django_distill import distill_re_path

urlpatterns = [
    url(r'^contact/$', views.ContactUs.as_view(), name='contact'),
    distill_re_path(r'^$',
                    views.HomeView.as_view(),
                    name='index',
                    distill_func=lambda: None)
]
Beispiel #4
0
def get_index():
    return None


def get_all_artists():
    return list(Artist.objects.values_list('slug', flat=True))


def get_all_releases():
    return list(Release.objects.values_list('slug', flat=True))


urlpatterns = [
    path('admin/', admin.site.urls),
    distill_path('', views.home, name='home'),
    distill_re_path(
        r'^artists/$', views.artists, name='artists', distill_func=get_index),
    distill_re_path(r'^artists/(?P<slug>[\w-]+)/$',
                    views.artist,
                    name='artist',
                    distill_func=get_all_artists),
    distill_re_path(r'^releases/$',
                    views.releases,
                    name='releases',
                    distill_func=get_index),
    distill_re_path(r'^releases/(?P<slug>[\w-]+)/$',
                    views.release,
                    name='release',
                    distill_func=get_all_releases),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url
from django.contrib import admin
from django.views.generic import TemplateView
from django_distill import distill_re_path


def get_index():
    pass


urlpatterns = [
    # url(r'^$', TemplateView.as_view(template_name="index.html")),
    distill_re_path(r'^$',
                    TemplateView.as_view(template_name="index.html"),
                    name='index',
                    distill_func=get_index),
    url(r'^admin/', admin.site.urls),
]
Beispiel #6
0
                name='url-positional-param',
                distill_func=test_positional_param_func),
    distill_url(r'^url/(?P<param>[\w]+)$',
                test_named_param_view,
                name='url-named-param',
                distill_func=test_named_param_func),

]


if settings.HAS_RE_PATH:
    urlpatterns += [

        distill_re_path(r'^re_path/$',
                        test_no_param_view,
                        name='re_path-no-param',
                        distill_func=test_no_param_func,
                        distill_file='test'),
        distill_re_path(r'^re_path/([\d]+)$',
                        test_positional_param_view,
                        name='re_path-positional-param',
                        distill_func=test_positional_param_func),
        distill_re_path(r'^re_path/(?P<param>[\w]+)$',
                        test_named_param_view,
                        name='re_path-named-param',
                        distill_func=test_named_param_func),

    ]


if settings.HAS_PATH: