Ejemplo n.º 1
0
Archivo: urls.py Proyecto: gunget/ch2
from django.conf.urls import url
from django.urls import path, re_path
#일반적인 패턴은 path, 복잡한 정규식을 써야할 땐 re_path를 사용
from bookmark.views import BookmarkDV, BookmarkLV
from . import views  #path를 쓸때는 이구문을 반드시 넣어야 함

app_name = 'bookmark'  #루트 url에서 namespace로 지정한 부분. 이 부분이 default url이 됨

urlpatterns = [
    url(r'^$', BookmarkLV.as_view(), name='index'),  #/bookmark/
    #이 패턴의 이름은 bookmark:index가 됨
    url(r'^(?P<pk>\d+)/$', BookmarkDV.as_view(),
        name='detail'),  #ex. /bookmark/1/
    #이 패턴의 이름은 bookmark:detail이 됨
    path('add/', views.BookmarkCreateView.as_view(),
         name='add'),  #/bookmark/add/
    path('change/', views.BookmarkChangeLV.as_view(),
         name='change'),  #/bookmark/change/
    path('<int:pk>/update/', views.BookmarkUpdateView.as_view(),
         name='update'),  #/bookmark/99/update/
    path('<int:pk>/delete/', views.BookmarkDeleteView.as_view(),
         name='delete'),  #/bookmark/99/delete/
    #url()은 re_url로 대체. views.뷰클래스명.as_view()쓰는 패턴에 유의
]
Ejemplo n.º 2
0
from django.urls import path
from bookmark.views import BookmarkLV, BookmarkDV

app_name = 'bookmark'
urlpatterns = [
    path('', BookmarkLV.as_view(), name='index'),
    path('<int:pk>', BookmarkDV.as_view(), name='detail'),
]
Ejemplo n.º 3
0
"""mysite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from bookmark.views import BookmarkLV, BookmarkDV

urlpatterns = [
    path('admin/', admin.site.urls),
    path('bookmark/', BookmarkLV.as_view(), name='index'),
    path('bookmark/<int:pk>/', BookmarkDV.as_view(), name='detail'),
]
Ejemplo n.º 4
0
from django.conf.urls.static import static
from django.conf import settings

from mysite.views import UserCreationView, UserCreationDoneTV

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^accounts/register/$', UserCreationView.as_view(), name='register'),
    url(r'^accounts/register/done/$',
        UserCreationDoneTV.as_view(),
        name='register_done'),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^bookmark/$', BookmarkLV.as_view(), name='bookmark_index'),
    url(r'^bookmark/(?P<pk>\d+)$', BookmarkDV.as_view(), name='detail'),
    url(r'^blog/$', PostLV.as_view(), name='blog_index'),
    url(r'^blog/(?P<pk>\d+)$', PostDV.as_view(), name='blog_detail'),
    url(r'^blog/add/$', PostCreateView.as_view(), name="blog_add"),
    url(r'^blog/(?P<pk>[0-9]+)/delete/$',
        PostDeleteView.as_view(),
        name="blog_delete"),
    url(r'^blog/(?P<pk>[0-9]+)/update/$',
        PostUpdateView.as_view(),
        name="blog_update"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""
r'^   =>  localhost:8000/
r'^admin ====> localhost:8000/admin
r'^bookmark/$'  =====>    localhost:8000/bookmark
"""
Ejemplo n.º 5
0
from django.conf.urls import url

from bookmark.views import BookmarkLV, BookmarkDV, \
    BookmarkCreateView, BookmarkChangeView, BookmarkUpdateView, BookmarkDeleteView

urlpatterns = [
    url(r'^$', BookmarkLV.as_view(), name='index'),
    url(r'^(?P<pk>\d+)/$', BookmarkDV.as_view(), name='detail'),

    url(r'^add/$', BookmarkCreateView.as_view(), name='add'),
    url(r'^change/$', BookmarkChangeView.as_view(), name='change'),
    url(r'^(?P<pk>[0-9]+)/update/$', BookmarkUpdateView.as_view(), name='update'),
    url(r'^(?P<pk>[0-9]+)/delete/$', BookmarkDeleteView.as_view(), name='delete'),
]
Ejemplo n.º 6
0
"""
from django.conf.urls import url,include
from django.contrib import admin
from mysite.views import IndexView,UserCreateView,UserCreateDoneTV

from bookmark.views import BookmarkLV, BookmarkDV
from blog.views import PostLV,PostDV

from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^bookmark/$', BookmarkLV.as_view(), name='bookmark_index'),
    url(r'^bookmark/(?P<pk>\d+)/$', BookmarkDV.as_view(),name="detail"),

    url(r'^accounts/',
        include('django.contrib.auth.urls')),

    url(r'^accounts/register/$', UserCreateView.as_view(), name='register'),
    url(r'^accounts/register/done/$',UserCreateDoneTV.as_view(),name='register_done'),

    url(r'^blog/$', PostLV.as_view(),
        name="blog_index"),

    url(r'^blog/(?P<pk>\d+)/$',
        PostDV.as_view(),
        name = "blog_detail"),
] + static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
Ejemplo n.º 7
0
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', IndexView.as_view(), name='new_index'),
    url(r'^about/$', aboutView.as_view(), name='about'),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^accounts/register/$', UserCreateView.as_view(), name='register'),
    url(r'^accounts/register/done/$',
        UserCreateDoneTV.as_view(),
        name='register_done'),
    url(r'^bookmark/$', BookmarkLV.as_view(), name='bookmark_index'),
    url(r'^bookmark/(?P<pk>\d+)/$',
        BookmarkDV.as_view(),
        name='bookmark_detail'),
    url(r'^bookmark/add/$', BookmarkCV.as_view(), name='bookmark_create'),
    url(r'^bookmark/update/(?P<pk>[0-9]+)/$',
        BookmarkUV.as_view(),
        name='bookmark_update'),
    url(r'^bookmark/delete/(?P<pk>[0-9]+)/$',
        BookmarkRV.as_view(),
        name='bookmark_delete'),
    url(r'^blog/$', PostLV.as_view(), name='blog_index'),
    url(r'^blog/(?P<pk>\d+)/$', PostDV.as_view(), name='blog_detail'),
    url(r'^blog/add/$', PostCV.as_view(), name='blog_create'),
    url(r'^blog/update/(?P<pk>[0-9]+)/$', PostUV.as_view(),
        name='blog_update'),
    url(r'^blog/delete/(?P<pk>[0-9]+)/$', PostRV.as_view(),
        name='blog_delete'),
Ejemplo n.º 8
0
"""mysite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    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 bookmark.models import Bookmark
from bookmark.views import BookmarkLV, BookmarkDV

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

#Class-based views for Bookmark app
url(r'^bookmark/$', BookmarkLV.as_view(model=Bookmark), name='index'),
url(r'^bookmark/(?P<pk>\d+)/$', BookmarkDV.as_view(model=Bookmark), name='detail'),
]
Ejemplo n.º 9
0
"""config URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from bookmark.views import BookmarkLV, BookmarkDV

urlpatterns = [
    path('admin/', admin.site.urls),

    #class-based views
    path('bookmark/', BookmarkLV.as_view(), name='index'),
    path('bookmark/(int:pk)', BookmarkDV.as_view(), name='detail')
]
Ejemplo n.º 10
0
from django.urls import path
from bookmark.views import BookmarkLV, BookmarkDV

app_name = "bookmark"

urlpatterns = [
    path('', BookmarkLV.as_view(), name='index'),
    path('<pk>/', BookmarkDV.as_view(), name='detail'),
]
Ejemplo n.º 11
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
#from bookmark.views import *
from bookmark.views import BookmarkLV, BookmarkDV
from bookmark.models import Bookmark

urlpatterns = [
    path('admin/', admin.site.urls),
    #class based views
    path("bookmark/", BookmarkLV.as_view(), name="index"),
    path("bookmark/<int:pk>/", BookmarkDV.as_view(), name="detail")
]
'''
    urls with view definition
    path("bookmark/", BookmarkVL.as_view(model=Bookmark), name="index")
    path("bookmark/<int:pk>/", BookmarkDV.as_view(model=Bookmark), name="detail")
'''
Ejemplo n.º 12
0
"""chapter2 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from bookmark.views import BookMarkLV, BookmarkDV

urlpatterns = [
    path('admin/', admin.site.urls),
    path('bookmark', BookMarkLV.as_view(), name="index"),
    path('bookmark/<int:pk>', BookmarkDV.as_view(), name="detail"),
]
Ejemplo n.º 13
0
"""mysite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/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. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""

from django.conf.urls import url
from bookmark.views import BookmarkLV, BookmarkDV

urlpatterns = [
    url('', BookmarkLV.as_view(), name='index'),
    url('bookmark/', BookmarkLV.as_view(), name='index'),
    url('bookmark/<pk>', BookmarkDV.as_view(), name='detail'),
]
Ejemplo n.º 14
0
from django.conf.urls import url
from bookmark.views import BookmarkLV, BookmarkDV

urlpatterns = [
    url(r'^$', BookmarkLV.as_view(), name='index'),
    url(r'^(?P<pk>\d+)/$', BookmarkDV.as_view(), name='detail'),
]
Ejemplo n.º 15
0
"""
from django.contrib import admin
from django.urls import path, include
from MY_HOME.views import IndexView, AboutView, UserCreateView, UserCreateDoneTV, CreateView
from bookmark.views import BookmarkDV, BookmarkLV, BookmarkCV, BookmarkUV, BookmarkRV
from blog.views import PostLV, PostCV, PostDV, PostUV

from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', IndexView.as_view(), name='index'),
    path('bookmark/', BookmarkLV.as_view(), name='bookmark_index'),
    path('bookmark/delete/<pk>', BookmarkRV.as_view(), name='bookmark_delete'),
    path('bookmark/update/<pk>', BookmarkUV.as_view(), name="bookmark_update"),
    path('bookmark/create', BookmarkCV.as_view(), name='bookmark_create'),
    path('bookmark/<pk>', BookmarkDV.as_view(), name='bookmark_detail'),
    path('accounts/register/', UserCreateView.as_view(), name='register'),
    path('about/', AboutView.as_view(), name="about"),
    path('accounts/', include('django.contrib.auth.urls')),
    path('accounts/register/', UserCreateView.as_view(), name='register'),
    path('accounts/register/done/',
         UserCreateDoneTV.as_view(),
         name='register_done'),
    path('blog/', PostLV.as_view(), name="blog"),
    path('blog/create', PostCV.as_view(), name="blog_create"),
    path('blog/update/<pk>', PostUV.as_view(), name="blog_update"),
    path('blog/delete/<pk>', PostDV.as_view(), name="blog_delete"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Ejemplo n.º 16
0
from django.urls import path
from bookmark.views import BookmarkLV, BookmarkDV

app_name = 'bookmark'
urlpatterns = [
    path('', BookmarkLV.as_view(), name='index'),
    path('<int:pk>/', BookmarkDV.as_view(), name="detail")
]
Ejemplo n.º 17
0
"""mysite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path

from bookmark.views import BookmarkLV, BookmarkDV

urlpatterns = [
    path('admin/', admin.site.urls),

    #Class-based views for Bookmark App
    path('bookmark/', BookmarkLV.as_view(), name='index'),
    path('bookmark/(?P<pk>\d+/$', BookmarkDV.as_view(), name='detail'),
]