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 menu.views import MenuView from resume.views import ResumeView from vacancy.views import VacancyView from signup.views import SignUpView from login.views import LogInView from home.views import HomeView from django.contrib.auth.views import LogoutView from django.views.generic import RedirectView urlpatterns = [ path('', MenuView.as_view()), path('signup', SignUpView.as_view()), path('signup/', RedirectView.as_view(url='/signup')), path('login', LogInView.as_view()), path('login/', RedirectView.as_view(url='/login')), path('home', HomeView.as_view()), path('home/', RedirectView.as_view(url='/home')), path('logout', LogoutView.as_view()), path('resumes/', ResumeView.as_view()), path('vacancies/', VacancyView.as_view()), path('resume/new', ResumeView.as_view()), path('vacancy/new', VacancyView.as_view()), path('none/new', HomeView.as_view()), path('admin/', admin.site.urls), ]
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 .views import MainView, MyLoginView, MySignupView, HomeView from resume.views import ResumeView, NewResumeView from vacancy.views import VacancyView, NewVacancyView from django.views.generic import RedirectView urlpatterns = [ path('admin/', admin.site.urls), path('', MainView.as_view()), path('resumes', ResumeView.as_view()), path('vacancies', VacancyView.as_view()), path('login/', RedirectView.as_view(url='/login')), path('signup/', RedirectView.as_view(url='/signup')), path('login', MyLoginView.as_view()), path('signup', MySignupView.as_view()), path('resume/new', NewResumeView.as_view()), path('vacancy/new', NewVacancyView.as_view()), path('home', HomeView.as_view()) ]
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 django.views.generic.base import TemplateView, RedirectView from common.views import CreateUserView, MyLoginView, ProfileView from resume.views import ResumeListView, ResumeView from vacancy.views import VacancyListView, VacancyView urlpatterns = [ path("admin/", admin.site.urls), path("home", ProfileView.as_view()), path("resume/new", ResumeView.as_view()), path("vacancy/new", VacancyView.as_view()), path("resumes", ResumeListView.as_view()), path("vacancies", VacancyListView.as_view()), path("", TemplateView.as_view(template_name="common/menu.html")), path("login", MyLoginView.as_view()), path("signup", CreateUserView.as_view()), path('login/', RedirectView.as_view(url='/login')), path('signup/', RedirectView.as_view(url='/signup')) ]
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 menu.views import MainMenuView from vacancy.views import VacancyView from home.views import CreateVacancyView from resume.views import ResumeView from home.views import CreateResumeView from home.views import HomeView from hyperjobauth.views import SignUpView from hyperjobauth.views import SignInView urlpatterns = [ # path('admin/', admin.site.urls), path("", MainMenuView.as_view()), path("signup", SignUpView.as_view()), path("login", SignInView.as_view()), path("vacancies", VacancyView.as_view()), path("home", HomeView.as_view()), path("vacancy/new", CreateVacancyView.as_view()), path("resume/new", CreateResumeView.as_view()), path("resumes", ResumeView.as_view()) ]
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 hyperjob.views import MenuView, MyLoginView, SignupView from hyperjob.views import NewResumeView, NewVacancyView, HomeView from resume.views import ResumeView from vacancy.views import VacancyView urlpatterns = [ path('', MenuView.as_view(), name='menu'), path('menu/', MenuView.as_view(), name='menu'), path('login/', MyLoginView.as_view(), name='login'), path('signup/', SignupView.as_view(), name='signup'), path('resumes/', ResumeView.as_view(), name='resume'), path('vacancies/', VacancyView.as_view(), name='vacancy'), path('resume/new/', NewResumeView.as_view(), name='new_resume'), path('vacancy/new/', NewVacancyView.as_view(), name='new_vacancy'), path('home/', HomeView.as_view(), name='home'), path('admin/', admin.site.urls), ]
from django.urls import path, include from stepik_vacancies import settings from vacancy.views import (custom_handler404, custom_handler500, HomeView, VacancyView, SpecialtyView, VacanciesView, CompanyView) handler404 = custom_handler404 handler500 = custom_handler500 urlpatterns = [ path('', HomeView.as_view(), name='home'), path('vacancies/', VacanciesView.as_view(), name='vacancies'), path('vacancies/cat/<str:spec>', SpecialtyView.as_view(), name='specialty'), path('companies/<int:comp_id>', CompanyView.as_view(), name='company'), path('vacancies/<int:vac_id>', VacancyView.as_view(), name='vacancy'), ] if settings.DEBUG: import debug_toolbar urlpatterns += [ path('__debug__/', include(debug_toolbar.urls)), ]
from vacancy.views import MainView, custom_handler404, custom_handler500, VacanciesView, SpecializationView, \ CompanyView, VacancyView, MyVacanciesView, MyVacancy, MySignupView, login, logout, \ MyResumeView, MyResumeCreate, CompanyEdit, MyCompanyView, NewVacancyView, SearchView, MyVacanciesCreateView handler404 = custom_handler404 handler500 = custom_handler500 urlpatterns = [ path('admin/', admin.site.urls), path('', MainView.as_view(), name='index'), # главная path('search/', SearchView.as_view(), name='search'), # поиск path('vacancies/', VacanciesView.as_view()), # все вакансии path('vacancies/cat/<str:specialization>/', SpecializationView.as_view()), # вакансии по специализации path('companies/<int:id>/', CompanyView.as_view()), # вакансии компании path('vacancies/<int:id>/', VacancyView.as_view(), name='vacancy'), # вакансия path('mycompany/', MyCompanyView.as_view()), # страница с кнопкой создания компании path('mycompany/edit/', CompanyEdit.as_view(), name='company_edit'), # страница редактирования компании path('mycompany/vacancies/', MyVacanciesView.as_view() ), # список вакансий в личном кабинете компании path('mycompany/vacancies/create/', MyVacanciesCreateView.as_view() ), # страница с кнопкой создания вакансии path('mycompany/vacancies/create/new', NewVacancyView.as_view()), # страница создания новой вакансии path('mycompany/vacancies/<int:id>', MyVacancy.as_view(), name='my_vacancy_edit'), # редактирование вакансии компании path('myresume/', MyResumeView.as_view()), # страница резюме пользователя