示例#1
0
"""iip_project 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 links.views import home_view, update_prices, LinkDeleteView, registerPage, loginPage, logutUser
urlpatterns = [
    path('admin/', admin.site.urls),
    path('', home_view, name='home'),
    path('update/', update_prices, name='update-prices'),
    path('delete/<pk>', LinkDeleteView.as_view(), name="delete"),
    path('register/', registerPage, name='register'),
    path('login/', loginPage, name='login'),
    path('logout/', logutUser, name='logout'),

]
示例#2
0
"""az_proj 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 links.views import home_view, update_prices, LinkDeleteView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', home_view, name='home'),
    path('update', update_prices, name="update-prices"),
    path('delete<pk>/', LinkDeleteView.as_view(), name="delete")
]
示例#3
0
文件: urls.py 项目: jorvalu/omaiga
         ProfileSentView.as_view(),
         name='profile_sent'),
    path('accounts/profile/<username>/voted',
         ProfileVotedView.as_view(),
         name='profile_voted'),
    path('accounts/profile/<username>/comments',
         ProfileCommentsView.as_view(),
         name='profile_comments'),

    # links app
    path('', LinkListView.as_view(), name='link_list'),
    path('latest/', LinkLatestView.as_view(), name='link_latest'),
    path('top/', LinkTopView.as_view(), name='link_top'),
    path('create/', LinkCreateView.as_view(), name='link_create'),
    path('detail/<pk>', LinkDetailView.as_view(), name='link_detail'),
    path('update/<pk>', LinkUpdateView.as_view(), name='link_update'),
    path('delete/<pk>', LinkDeleteView.as_view(), name='link_delete'),

    # voting app
    path('vote/<pk>', VoteView.as_view(), name='vote'),

    # comments app
    path('detail/<pk>/comment',
         CommentCreateView.as_view(),
         name='comment_create'),
    path('detail/<id>/comment/delete/<pk>',
         CommentDeleteView.as_view(),
         name='comment_delete'),
    path('detail/comment/point/<pk>/', PointView.as_view(), name='point'),
]
示例#4
0
文件: urls.py 项目: sampyxis/consnews
from django.conf.urls import include, url
from django.contrib import admin
from links.views import LinkListView
from links.views import UserProfileDetailView
from django.contrib.auth.decorators import login_required as auth
from links.views import UserProfileEditView
from links.views import LinkCreateView
from links.views import LinkDetailView
from links.views import LinkUpdateView
from links.views import LinkDeleteView
from links.views import VoteFormView

urlpatterns = [
    url(r'^static/(?P<path>.*)$','django.views.static.serve',{'document_root': 'static'}),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', LinkListView.as_view(), name='home'),
    url(r'^login/$', 'django.contrib.auth.views.login', {
    'template_name': 'login.html'}, name="login"),
    url(r'^logout/$', 'django.contrib.auth.views.logout_then_login',
        name="logout"),
    url(r'^accounts/', include('registration.backends.simple.urls')),
    url(r'^users/(?P<slug>\w+)/$', UserProfileDetailView.as_view(), name="profile"),
    url(r'^edit_profile/$', auth(UserProfileEditView.as_view()), name="edit_profile"),
    url(r'^link/create/$', auth(LinkCreateView.as_view()),name='link_create'),
    url(r'^link/(?P<pk>\d+)/$', LinkDetailView.as_view(), name='link_detail'),
    url(r'^link/update/(?P<pk>\d+)/$', auth(LinkUpdateView.as_view()), name='link_update'),
    url(r'^link/delete/(?P<pk>\d+)/$', auth(LinkDeleteView.as_view()), name='link_delete'),
    url(r'^comments/', include('django_comments.urls')),
    url(r'^vote/$', auth(VoteFormView.as_view()), name="vote"),
]
示例#5
0
urlpatterns = [
    url(r'^$', redirect_root),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^comments/', include('django_comments.urls')),
    url(r'^home/$', LinkListView.as_view(), name='home'),
    url(r'^pages/', include('django.contrib.flatpages.urls')),
    url(r'^contact/', include(contact_urls)),
    url(r'^login/$',
        "django.contrib.auth.views.login", {"template_name": "login.html"},
        name="login"),
    url(r'^logout/$',
        "django.contrib.auth.views.logout_then_login",
        name="logout"),
    url(r'^accounts/', include("registration.backends.simple.urls")),
    url(r"^users/(?P<slug>\w+)/$",
        UserProfileDetailView.as_view(),
        name="profile"),
    url(r"edit_profile/$",
        auth(UserProfileEditView.as_view()),
        name="edit_profile"),
    url(r"^link/create/$", auth(LinkCreateView.as_view()), name="link_create"),
    url(r"^link/(?P<pk>\d+)$", LinkDetailView.as_view(), name="link_detail"),
    url(r"^link/update/(?P<pk>\d+)$",
        auth(LinkUpdateView.as_view()),
        name="link_update"),
    url(r"^link/delete/(?P<pk>\d+)$",
        auth(LinkDeleteView.as_view()),
        name="link_delete"),
    url(r'^vote/$', auth(VoteFormView.as_view()), name="vote"),
]
示例#6
0
urlpatterns = patterns('',

    url(r'^admin/', include(admin.site.urls)),
    url(r'^comments/', include("django.contrib.comments.urls")),
    url(r'^$',LinkListView.as_view(), name='home'),
    
    url(r"^login/$", "django.contrib.auth.views.login",
        {"template_name": "login.html"}, name="login"),
    url(r"^logout/$", "django.contrib.auth.views.logout_then_login",
        name="logout"),
        
    url(r"^accounts/", include("registration.backends.simple.urls")),
    url(r"^users/(?P<slug>\w+)/$", UserProfileDetailView.as_view(), 
        name="profile"),
    url(r"edit_profile/$", UserProfileEditView.as_view(),
        name="edit_profile"),
        
    url(r"^link/create/$", auth(LinkCreateView.as_view()),
        name="link_create"),
    
    url(r"^link/(?P<pk>\d+)$", LinkDetailView.as_view(),
        name="link_detail"),
        
    url(r"^link/update/(?P<pk>\d+)$", auth(LinkUpdateView.as_view()),
        name="link_update"),
        
    url(r"^link/delete/(?P<pk>\d+)$", auth(LinkDeleteView.as_view()),
        name="link_delete"),
)
示例#7
0
    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, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
from links.views import LinkListView
from links.views import UserProfileDetailView
from django.contrib.auth.decorators import login_required as auth # Keep non-users out
from links.views import UserProfileEditView
from links.views import LinkCreateView, LinkDetailView
from links.views import LinkEditView
from links.views import LinkDeleteView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', LinkListView.as_view(), name='home'),
    url(r'^login/$', auth_views.login, name='login'),
    url(r'^logout/$', auth_views.logout, name='logout'),
    url(r'^accounts/', include('registration.backends.simple.urls')),
    url(r'^users/(?P<slug>\w+)/$', UserProfileDetailView.as_view(),name='profile'),
    url(r'^edit_profile/$', auth(UserProfileEditView.as_view()), name='edit_profile'),
    url(r'^link/submit/$', auth(LinkCreateView.as_view()), name='link_submit'),
    url(r'^link/(?P<pk>\d+)/$', LinkDetailView.as_view(), name='link_detail'),
    url(r'^link/edit/(?P<pk>\d+)/$', auth(LinkEditView.as_view()), name='link_edit'),
    url(r'^link/delete/(?P<pk>\d+)/$', auth(LinkDeleteView.as_view()), name='link_delete'),
    url(r'^comments/', include('django_comments.urls')),
]
示例#8
0
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required

from django.urls import include, path

from links import views as linkviews

from links.views import LinkDetailView, LinkUpdateView, LinkDeleteView

# (P<pk>\d+) used to get primary key of link
urlpatterns = [
    path('login/', auth_views.login, name='login'),
    path('logout/', auth_views.logout, name='logout'),
    path('signup/', linkviews.signup, name='signup'),
    path('admin/', admin.site.urls),
    path('links/create/',
         login_required(linkviews.link_create),
         name='link_create'),
    path('link/(P<pk>\d+)/', LinkDetailView.as_view(), name='link_detail'),
    path('links/delete/(P<pk>\d+)',
         login_required(LinkDeleteView.as_view()),
         name='link_delete'),
    path('links/update/(P<pk>\d+)/',
         login_required(LinkUpdateView.as_view()),
         name='link_update'),
    path('comment/(P<pk>\d+)', linkviews.link_comment, name='link_comment'),
    path('reply/(P<pk>\d+)', linkviews.reply_comment, name='reply_comment'),
    path('vote/', login_required(linkviews.updoot), name='vote'),
    path('', include('links.urls'))
]