Beispiel #1
0
from django.conf.urls import url

from shelf.views import AuthorListView, AuthorDetailView, BookListView, BookDetailView, PublisherListView, PublisherDetailView

# w urlpattern najpierw wyrazenie regularne, potem co ma pokazac
# jezel icos nie jest zaimportowane to podkresla na czerowo
urlpatterns = [
    url(r'^authors/$', AuthorListView.as_view(), name='author-list'),
    url(r'^authors/(?P<pk>\d+)/$',
        AuthorDetailView.as_view(),
        name='author-detail'),
    url(r'^books/$', BookListView.as_view(), name='book-list'),
    url(r'^books/(?P<pk>\d+)/$', BookDetailView.as_view(), name='book-detail'),
    url(r'^publishers/$', PublisherListView.as_view(), name='publisher-list'),
    url(r'^publishers/(?P<pk>\d+)/$',
        PublisherDetailView.as_view(),
        name='publisher-detail'),
]
Beispiel #2
0
# -*- coding: utf-8-sig -*-
from django.conf.urls import patterns, include, url

from shelf.views import (AuthorListView, AuthorDetailView, BookListView, BookDetailView)

urlpatterns = patterns('',
	url(r'^autorzy/$', AuthorListView.as_view(), name='author-list'),
    	url(r'^autorzy/(?P<pk>\d+)/$', AuthorDetailView.as_view(), name='author-detail'),
    	url(r'^ksiazki/$', BookListView.as_view(), name='book-list'),
    	url(r'^ksiazki/(?P<pk>\d+)/$', BookDetailView.as_view(), name='book-detail'),
)
Beispiel #3
0
# -*- coding: utf-8-sig -*-
from django.conf.urls import patterns, include, url

from shelf.views import (AuthorListView, AuthorDetailView, BookListView,
                         BookDetailView)

urlpatterns = patterns(
    '',
    url(r'^autorzy/$', AuthorListView.as_view(), name='author-list'),
    url(r'^autorzy/(?P<pk>\d+)/$',
        AuthorDetailView.as_view(),
        name='author-detail'),
    url(r'^ksiazki/$', BookListView.as_view(), name='book-list'),
    url(r'^ksiazki/(?P<pk>\d+)/$',
        BookDetailView.as_view(),
        name='book-detail'),
)
Beispiel #4
0
from django.conf.urls import patterns, include, url


from shelf.views import AuthorListView, AuthorDetailView, AuthorAddView, BookListView, BookDetailView

urlpatterns = patterns('',
    url(r'^authors/$', AuthorListView.as_view(), name='author-list'),
    url(r'^authors/(?P<pk>\d+)/$', AuthorDetailView.as_view(), name='author-detail'),
    url(r'^authors/new/$', AuthorAddView.as_view(), name='author-new'),
    url(r'^books/$', BookListView.as_view(), name='book-list'),
    url(r'^books/(?P<pk>\d+)/$', BookDetailView.as_view(), name='book-detail'),
)
Beispiel #5
0
#from django.conf.urls import url, include, patterns
from django.urls import path, include
from shelf.views import AuthorListView, AuthorDetailView, BookListView, BookDetailView
app_name = 'shelf'

urlpatterns = [
    path('authors/', AuthorListView.as_view(), name='author-view'),
    path(
        'authors/<int:pk>/', AuthorDetailView.as_view(), name='author-detail'
    ),  #<int:id> oznacza, że pojawią się cyfry a id to zmienna przekazywana do widoku
    path('books/<int:pk>/', BookDetailView.as_view(), name='book-detail'),
    path('books/', BookListView.as_view(), name='book-list'),
]
Beispiel #6
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/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. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import include, url
from django.contrib import admin

from shelf.views import BookListView, PublisherListView
from contact.views import MessageAddView

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^shelf/', include('shelf.urls', namespace='shelf')),

    url(r'^books/$', BookListView.as_view()),
    url(r'^publishers/$', PublisherListView.as_view()),

    url(r'^contact/$', MessageAddView.as_view()),
    url(r'^$', 'shelf.views.index_view', name='main-page'),
    url(r'^accounts/', include('allauth.urls')),
]