示例#1
0
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 main.views import categories, Activate, obtain_auth_token, obtain_auth_token_rrss, GetUserView, LogoutView, signUp, form_login, index
from django.conf.urls import url, include

urlpatterns = [
    path('', index, name="index"),
    path('categories/', categories, name="categories"),
    path('admin/', admin.site.urls),
    path('accounts/', include('django.contrib.auth.urls')),
    path('login/', obtain_auth_token),
    path('logout/', LogoutView.as_view()),
    path('getuser/', GetUserView.as_view()),
    path('signup/', signUp),
    path('activate/', Activate.as_view(), name='activate'),
    path('obtain_auth_token_rrss/', obtain_auth_token_rrss),
    path('form-login/', form_login),
    url(r'^auth/', include('social_django.urls', namespace='social')),
    path(r'i18n/', include('django.conf.urls.i18n')),
]
示例#2
0
    CreatePostView,
    SearchView,
    UserView,
    AccountView,
    ChangePassword,
)

from main.ajax_views import (
    ajax_vote_comment,
    ajax_vote_post,
)

urlpatterns = [
    path("", HomeView.as_view(), name="home"),
    path("login/", LoginView.as_view(), name="login"),
    path("logout/", LogoutView.as_view(), name="logout"),
    path("register/", RegisterView.as_view(), name="register"),
    path("create/topic", CreateTopicView.as_view(), name="create_topic"),
    path("topic/<str:name>/", TopicView.as_view(), name="topic"),
    path("topic/<str:name>/<slug:slug>", InfoView.as_view(), name="info"),
    path("create/post", CreatePostView.as_view(), name="create_post"),
    path("search/<str:q>", SearchView.as_view(), name="search"),
    path('user/<str:user>', UserView.as_view(), name='profile'),
    path('user/<str:user>/posts', UserView.as_view()),
    path('account', AccountView.as_view(), name='account'),
    path('account/password', ChangePassword.as_view(), name='change_password'),
    path(
        "ajax/vote/post/<int:post_id>/<int:vote>/",
        ajax_vote_post,
        name="ajax_vote_post",
    ),
示例#3
0
文件: urls.py 项目: Kamil783/web
from django.urls import path
from . import views
from main.views import HomeView, Chats, somethingwrong, Games, RegisterView, LoginView, LogoutView

urlpatterns = [
    path('', HomeView.as_view(), name="home"),
    path('massenger', Chats.as_view(), name="chats"),
    path('calendar', somethingwrong.as_view(), name="calendar"),
    path('teams', somethingwrong.as_view(), name="teams"),
    path('games', Games.as_view(), name="games"),
    path('signin', LoginView.as_view(), name="signin"),
    path('signup', RegisterView.as_view(), name="signup"),
    path('logout', LogoutView.as_view(), name="logout")
]
示例#4
0
    password_reset_complete,
)

from main.views import (
    RegisterView,
    LoginView,
    LogoutView
)

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

    url(r'^register/$', RegisterView.as_view(), name='register'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),

    url(r'^password/reset/$',
        password_reset,
        {'template_name': 'project/password_reset.html'},
        name='password_reset'),

    url(r'^password/reset/done$',
        password_reset_done,
        {'template_name': 'project/password_reset_done.html'},
        name='password_reset_done'),

    url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
        password_reset_confirm,
        {'template_name': 'project/password_reset_confirm.html'},
        name='password_reset_confirm'),
示例#5
0
from django.contrib.auth.views import (
    password_reset,
    password_reset_done,
    password_reset_confirm,
    password_reset_complete,
)

from main.views import (RegisterView, LoginView, LogoutView)

urlpatterns = [
    url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('main.urls', namespace='main')),
    url(r'^register/$', RegisterView.as_view(), name='register'),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),
    url(r'^password/reset/$',
        password_reset, {'template_name': 'project/password_reset.html'},
        name='password_reset'),
    url(r'^password/reset/done$',
        password_reset_done,
        {'template_name': 'project/password_reset_done.html'},
        name='password_reset_done'),
    url(r'^password/reset/confirm/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
        password_reset_confirm,
        {'template_name': 'project/password_reset_confirm.html'},
        name='password_reset_confirm'),
    url(r'^password/reset/confirm/done$',
        password_reset_complete,
        {'template_name': 'project/password_reset_complete.html'},
        name='password_reset_complete'),
示例#6
0
"""cyclesharing URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.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 main.views import IndexView, LoginView, LogoutView, SignView



urlpatterns = [
	path('', IndexView.as_view(), name="index"),
    path('admin/', admin.site.urls),

    path('login/', LoginView.as_view(), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),
    path('registration/', SignView.as_view(), name='signup'),

] 
示例#7
0
"""DYS URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/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.urls import path, re_path, include

from main.views import MainPageView, RegisterView, LoginView, DashboardView, LogoutView, ProfileView

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', MainPageView.as_view(), name='main-page'),
    path('register/', RegisterView.as_view(), name='register'),
    path('accounts/login/', LoginView.as_view(), name='login'),
    path('accounts/logout/', LogoutView.as_view(), name='logout'),
    path('dashboard/', DashboardView.as_view(), name='dashboard'),
    path('profile/', ProfileView.as_view(), name='profile'),
]
示例#8
0
    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, include
from django.contrib import admin
from django.views.generic.base import RedirectView
from django.contrib.auth.decorators import login_required
from django.views.i18n import JavaScriptCatalog

from main.views import IndexView, LogoutView, TransactionView, ChangeMonthView, MonthView, BankDateView, \
    DeleteTransaction

favicon_view = RedirectView.as_view(url='/static/images/favicon.ico', permanent=True)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^favicon\.ico$', favicon_view),
    url(r'^logout/', login_required(LogoutView.as_view(), login_url="/admin/login/"), name='logout'),
    url(r'^transaction/', TransactionView.as_view(), name='transaction'),
    url(r'^delete-transaction/', DeleteTransaction.as_view(), name='delete_transaction'),
    url(r'^select-month/', ChangeMonthView.as_view(), name='select_month'),
    url(r'^month/', MonthView.as_view(), name='month'),
    url(r'^bank-date', BankDateView.as_view(), name='bank_date'),
    url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
    url(r'^api/', include('api.urls')),
    url(r'^$', login_required(IndexView.as_view(), login_url="/admin/login/"), name='login'),
]
示例#9
0
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.conf.urls import url
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path

from dzikipik import settings
from main.views import IndexView, BlogView, GalleryView, PricingView, ContactView, LoginView, RegisterView, SessionView, \
    PostView, LogoutView

urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'^$', IndexView.as_view(), name="index"),
    url('blog/', BlogView.as_view(), name="blog"),
    url('galeria/', GalleryView.as_view(), name="gallery"),
    url('cennik/', PricingView.as_view(), name="pricing"),
    url('kontakt/', ContactView.as_view(), name="contact"),
    url('login/', LoginView.as_view(), name="login"),
    url('logout/', LogoutView.as_view(), name="logout"),
    url('register/', RegisterView.as_view(), name="register"),
    url('sesja/', SessionView.as_view(), name="session"),
    url('post/(?P<id>(\d)+)', PostView.as_view(), name="post"),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)