コード例 #1
0
from django.contrib.auth.views import LoginView, LogoutView
from django.urls import path

from accountapp.views import AccountCreateView, Hello_World, AccountDetailView, AccountUpdateView, AccountDeleteView

app_name = "accountapp"

urlpatterns = [
        path('hello_world/', Hello_World, name="hello_world"),
        path('create/', AccountCreateView.as_view(), name="create"),    ##as_view()라는 것을 붙여주어야 한다.

        path('login/', LoginView.as_view(template_name='accountapp/login.html'), name='login'),    ##login view에는 탬플릿을 설정해 주어야 한다.
        path('logout/', LogoutView.as_view(), name='logout'),    
        path('detail/<int:pk>', AccountDetailView.as_view(), name='detail'), ##pk는 해당 user의 고유 정보 값
        path('update/<int:pk>', AccountUpdateView.as_view(), name='update'), ##pk는 해당 user의 고유 정보 값
        path('delete/<int:pk>', AccountDeleteView.as_view(), name='delete'), ##pk는 해당 user의 고유 정보 값
]
コード例 #2
0
from django.contrib.auth.views import LoginView, LogoutView
from django.urls import path
from accountapp.views import AccountCreateView, AccountDetailView, AccountUpdateView, AccountDeleteView

app_name = "accountapp"

urlpatterns = [

    path('login/', LoginView.as_view(template_name = 'accountapp/login.html'), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),

    path('create/', AccountCreateView.as_view(), name='create'),
    path('detail/<int:pk>', AccountDetailView.as_view(), name='detail'),
    path('update/<int:pk>', AccountUpdateView.as_view(), name='update'),
    path('delete/<int:pk>', AccountDeleteView.as_view(), name='delete'),

]

コード例 #3
0
from django.contrib.auth.views import LoginView, LogoutView
from django.urls import path

from accountapp.views import AccountCreateView, \
    AccountDetailView, AccountUpdateView, AccountDeleteView

app_name = "accountapp"

urlpatterns = [
    path('login/',
         LoginView.as_view(template_name='accountapp/login.html'),
         name="login"),
    path('logout/', LogoutView.as_view(), name="logout"),
    path('create/', AccountCreateView.as_view(), name="create"),
    path('detail/<int:pk>/', AccountDetailView.as_view(), name="detail"),
    path('update/<int:pk>/', AccountUpdateView.as_view(), name="update"),
    path('delete/<int:pk>/', AccountDeleteView.as_view(), name="delete"),
]