{"id":377675,"date":"2024-06-01T09:00:06","date_gmt":"2024-06-01T09:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=377675"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=377675","title":{"rendered":"<span>\u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0438\u043a\u0430 \u0432 Django: \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/ef5\/132\/2a0\/ef51322a03cedfd7a86f07beadba8c37.jpg\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef5\/132\/2a0\/ef51322a03cedfd7a86f07beadba8c37.jpg\" data-blurred=\"true\"\/><\/figure>\n<p><em>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/em><\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043c\u0430\u0433\u0438\u0438, \u043d\u043e \u043d\u0435 \u0442\u043e\u0439, \u0447\u0442\u043e \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e\u0442 \u0432 \u0425\u043e\u0433\u0432\u0430\u0440\u0442\u0441\u0435. \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0438\u043a\u0430, \u0442\u043e\u0447\u043d\u0435\u0435 <strong>\u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u0444\u043e\u0440\u043c \u0432 Django<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043a \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u0442, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>django-formtools<\/code> \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e\u043b\u0448\u0435\u0431\u0441\u0442\u0432\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435.<\/p>\n<p>\u0410 \u043f\u0440\u0438\u0447\u0435\u043c \u0442\u0443\u0442 \u043c\u0430\u0433\u0438\u044f? \u0423\u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b<\/h4>\n<p>\u041c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0440\u044f\u0434 \u0444\u0438\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043e\u043f\u044b\u0442.<\/p>\n<p>\u041c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b <strong>\u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0438\u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u0438\u0435,<\/strong> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0448\u0430\u0433\u0438. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u043c\u0435\u043d\u0435\u0435 \u0443\u0441\u0442\u0440\u0430\u0448\u0430\u044e\u0449\u0435\u0439 \u0438 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0435\u0451 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0442\u043e\u0447\u043d\u043e \u0432\u0438\u0434\u044f\u0442, \u0433\u0434\u0435 \u043e\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0435\u0449\u0435 \u0448\u0430\u0433\u043e\u0432 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043f\u043e\u043b\u044f.<\/p>\n<p>\u041d\u0430 \u043c\u043e\u0431\u0438\u043b\u043a\u0430\u0445 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e\u0439. <strong>\u041c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438<\/strong> \u043f\u043e \u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <code>django-formtools<\/code>:<\/p>\n<pre><code class=\"bash\">pip install django-formtools<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c<code>formtools<\/code> \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 Django:<\/p>\n<pre><code class=\"yaml\">INSTALLED_APPS = [     ...     'formtools',     ... ]<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>django-formtools<\/code> \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<h3>SessionWizardView \u0438 CookieWizardView<\/h3>\n<p>\u0414\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u0441\u043b\u043e\u0432\u0430 &#171;<em>Wizard<\/em>&#187; \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u0438\u043c, \u043a\u0430\u043a\u043e\u0435 \u043e\u043d\u043e \u0435\u0441\u0442\u044c.<\/p>\n<p><code>django-formtools<\/code> \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0444\u043e\u0440\u043c: <code>SessionWizardView<\/code> \u0438 <code>CookieWizardView<\/code>. \u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432.<\/p>\n<ul>\n<li>\n<p><code>SessionWizardView<\/code> <strong>\u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/strong> \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u043c\u0435\u0435\u043c \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0441\u0441\u0438\u0438 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p><code>CookieWizardView<\/code> <strong>\u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u0443\u043a\u0430\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/strong>. \u041c\u0435\u0442\u043e\u0434 \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0433\u0434\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u0435\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0435\u043d, \u0442.\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 <code>SessionWizardView<\/code> \u0438 <code>CookieWizardView<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043a \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u0440\u0430\u0431\u043e\u0442 \u0441 <code>SessionWizardView<\/code>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u043e\u0440\u043c, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0433\u0443 \u0432 \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u0444\u043e\u0440\u043c. \u0417\u0430\u0442\u0435\u043c \u044d\u0442\u0438 \u0444\u043e\u0440\u043c\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0442 <code>SessionWizardView<\/code>. \u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>done<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0448\u0430\u0433\u043e\u0432 \u0444\u043e\u0440\u043c\u044b. \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 \u0411\u0414 \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0441 <code>SessionWizardView<\/code>:<\/p>\n<pre><code class=\"python\">from django import forms from django.http import HttpResponseRedirect from formtools.wizard.views import SessionWizardView  class ContactForm1(forms.Form):     name = forms.CharField(max_length=100)  class ContactForm2(forms.Form):     age = forms.IntegerField()  class ContactWizard(SessionWizardView):     template_name = \"contact_form.html\"     form_list = [ContactForm1, ContactForm2]      def done(self, form_list, **kwargs):         form_data = [form.cleaned_data for form in form_list]         # \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445         return HttpResponseRedirect('\/finished\/')<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f <code>CookieWizardView<\/code> \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 <code>SessionWizardView<\/code>, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u0443\u043a\u0430\u0445, \u0430 \u043d\u0435 \u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 <code>CookieWizardView<\/code>:<\/p>\n<pre><code class=\"python\">from django import forms from formtools.wizard.views import CookieWizardView  class FeedbackForm1(forms.Form):     feedback = forms.CharField(widget=forms.Textarea)  class FeedbackForm2(forms.Form):     email = forms.EmailField()  class FeedbackWizard(CookieWizardView):     template_name = \"feedback_form.html\"     form_list = [FeedbackForm1, FeedbackForm2]      def done(self, form_list, **kwargs):         form_data = [form.cleaned_data for form in form_list]         # \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0442\u0437\u044b\u0432\u043e\u0432         return HttpResponseRedirect('\/feedback\/thanks\/')<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0434\u043b\u044f \u0444\u043e\u0440\u043c \u0432 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0432\u0438\u0437\u0430\u0440\u0434\u0430\u0445 Django \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 HTML-\u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0432\u0441\u0435 \u0444\u043e\u0440\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d <code>formtools\/wizard\/wizard_form.html<\/code>. \u041e\u0434\u043d\u0430\u043a\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>template_name<\/code> \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <code>get_template_names()<\/code>. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <code>wizard<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0440\u044f\u0434 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>wizard.form<\/code> \u2014 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u044b \u0438\u043b\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0444\u043e\u0440\u043c \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u0443\u0441\u0442\u044b\u043c, \u0442\u0430\u043a \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps<\/code> \u2014 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0448\u0430\u0433\u0430\u0445: <\/p>\n<ul>\n<li>\n<p><code>wizard.steps.step0<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0448\u0430\u0433 (\u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u0441 \u043d\u0443\u043b\u044f).<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.step1<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0448\u0430\u0433 (\u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u0441 \u0435\u0434\u0438\u043d\u0438\u0446\u044b).<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.count<\/code> \u2014 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.first<\/code> \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.last<\/code> \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.current<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.next<\/code> \u2014 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.prev<\/code> \u2014 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.index<\/code> \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.all<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432\u0438\u0437\u0430\u0440\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u044f\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f  <code>get_context_data()<\/code> \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u0430 <code>WizardView<\/code>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0433\u043e \u0432\u0438\u0437\u0430\u0440\u0434\u0430:<\/p>\n<pre><code class=\"yaml\">{% extends \"base.html\" %} {% load i18n %}  {% block head %} {{ wizard.form.media }} {% endblock %}  {% block content %} &lt;p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}&lt;\/p> &lt;form action=\"\" method=\"post\">{% csrf_token %} &lt;table> {{ wizard.management_form }} {% if wizard.form.forms %}     {{ wizard.form.management_form }}     {% for form in wizard.form.forms %}         {{ form.as_table }}     {% endfor %} {% else %}     {{ wizard.form.as_table }} {% endif %} &lt;\/table> {% if wizard.steps.prev %} &lt;button name=\"wizard_goto_step\" type=\"submit\" value=\"{{ wizard.steps.first }}\">{% translate \"first step\" %}&lt;\/button> &lt;button name=\"wizard_goto_step\" type=\"submit\" value=\"{{ wizard.steps.prev }}\">{% translate \"prev step\" %}&lt;\/button> {% endif %} &lt;input type=\"submit\" value=\"{% translate \"submit\" %}\"\/> &lt;\/form> {% endblock %}<\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u043e \u044e\u0437\u0430\u0442\u044c <code>{{ wizard.management_form }}<\/code> \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0430\u0440\u0434 \u043c\u043e\u0433 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043c\u0435\u0436\u0434\u0443 \u0448\u0430\u0433\u0430\u043c\u0438. <\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 URL<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0432\u0438\u0437\u0430\u0440\u0434 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e URL Django. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0432\u0438\u0437\u0430\u0440\u0434\u0435. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>WizardView<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 URL \u0432 \u0444\u0430\u0439\u043b\u0435 <code>urls.py<\/code>. \u041c\u0435\u0442\u043e\u0434 <code>as_view()<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0438\u0437\u0430\u0440\u0434\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0444\u043e\u0440\u043c \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438:<\/p>\n<pre><code class=\"python\">from django.urls import path from myapp.forms import ContactForm1, ContactForm2 from myapp.views import ContactWizard  urlpatterns = [     path('contact\/', ContactWizard.as_view([ContactForm1, ContactForm2])), ]<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u043e\u0440\u043c \u043a\u0430\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>form_list<\/code>:<\/p>\n<pre><code class=\"python\">class ContactWizard(WizardView):     form_list = [ContactForm1, ContactForm2]<\/code><\/pre>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0435. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0448\u0430\u0433\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u043e\u043f\u043b\u0430\u0442\u044b. \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0448\u0430\u0433\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u043b\u0430\u0442\u044b. \u0415\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043e\u043f\u043b\u0430\u0442\u0430 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u043e\u0439, \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u044b. \u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u043a\u0443\u043f\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0432\u0438\u0437\u0430\u0440\u0434\u0430:<\/p>\n<pre><code class=\"python\">from django.http import HttpResponseRedirect from formtools.wizard.views import SessionWizardView  FORMS = [(\"address\", myapp.forms.AddressForm),          (\"paytype\", myapp.forms.PaymentChoiceForm),          (\"cc\", myapp.forms.CreditCardForm),          (\"confirmation\", myapp.forms.OrderForm)]  TEMPLATES = {\"address\": \"checkout\/billingaddress.html\",              \"paytype\": \"checkout\/paymentmethod.html\",              \"cc\": \"checkout\/creditcard.html\",              \"confirmation\": \"checkout\/confirmation.html\"}  class OrderWizard(SessionWizardView):     def get_template_names(self):         return [TEMPLATES[self.steps.current]]      def done(self, form_list, **kwargs):         do_something_with_the_form_data(form_list)         return HttpResponseRedirect('\/page-to-redirect-to-when-done\/')<\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 <code>urls.py<\/code> \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">urlpatterns = [     path('checkout\/', OrderWizard.as_view(FORMS, condition_dict={'cc': pay_by_credit_card})), ]<\/code><\/pre>\n<p><code>condition_dict<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043a\u0430\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 <code>as_view()<\/code> \u0438\u043b\u0438 \u043a\u0430\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>condition_dict<\/code>:<\/p>\n<pre><code class=\"python\">class OrderWizard(WizardView):     condition_dict = {'cc': pay_by_credit_card}<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>get_template_names()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0434\u0438\u043d \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<h4>\u041f\u0440\u043e\u0447\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b WizardView<\/h4>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>done()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0448\u0430\u0433\u043e\u0432, \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0438\u0437\u0430\u0440\u0434\u0430 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430\u0445.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0448\u0430\u0433\u0430\u0445. \u041f\u0440\u0435\u0444\u0438\u043a\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0438\u043c\u0435\u043d\u0438 \u0448\u0430\u0433\u0430, \u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0444\u043e\u0440\u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"python\">get_form_prefix(step=None, form=None)<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>initial<\/code> \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430. \u0415\u0441\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0438\u0437\u0430\u0440\u0434\u0430, \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c:<\/p>\n<pre><code class=\"python\">get_form_initial(step)<\/code><\/pre>\n<p><code>get_form_kwargs(step)<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435.<\/p>\n<p><code>get_form_instance(step)<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0448\u0430\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>ModelForm<\/code>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>instance<\/code> \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>ModelForm<\/code> \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0448\u0430\u0433\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043f. \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0448\u0430\u0433\u043e\u0432. \u041c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0448\u0430\u0433 \u0444\u043e\u0440\u043c\u044b:<\/p>\n<pre><code class=\"python\">def get_context_data(self, form, **kwargs):     context = super().get_context_data(form=form, **kwargs)     if self.steps.current == 'my_step_name':         context.update({'another_var': True})     return context<\/code><\/pre>\n<p><code>get_prefix(request, *args, **kwargs)<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 \u043a\u0430\u043a \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0437\u0430\u0440\u0434\u0430. \u041f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">from django.http import HttpResponseRedirect from formtools.wizard.views import SessionWizardView  FORMS = [(\"address\", myapp.forms.AddressForm),          (\"payment\", myapp.forms.PaymentForm)]  class CheckoutWizard(SessionWizardView):     def done(self, form_list, **kwargs):         process_order(form_list)         return HttpResponseRedirect('\/order\/complete\/')  urlpatterns = [     path('checkout\/', CheckoutWizard.as_view(FORMS)), ]<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c <code>CheckoutWizard<\/code> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0430 \u0448\u0430\u0433\u0430: \u0432\u0432\u043e\u0434 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u043e\u043f\u043b\u0430\u0442\u0443. \u041c\u0435\u0442\u043e\u0434 <code>done<\/code> \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0448\u0430\u0433\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430.<\/p>\n<hr\/>\n<p>\u0418\u0442\u0430\u043a, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0444\u043e\u0440\u043c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043d\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0438\u0437\u0430\u0440\u0434\u043e\u0432, \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u0443\u044f \u0438\u0445 \u043f\u043e\u0434 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041c\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448 Django.<\/p>\n<p><em>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e \u043f\u0440\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0443\u0440\u043e\u043a 3 \u0438\u044e\u043d\u044f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044c\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 FastAPI-JSON:API. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c <\/em><a href=\"https:\/\/otus.pw\/uoXMd\/\"><em>\u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043a\u0443\u0440\u0441\u0430 \u00abDjango-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u00bb.<\/em><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/818117\/\"> https:\/\/habr.com\/ru\/articles\/818117\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p><em>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/em><\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u043c\u0430\u0433\u0438\u0438, \u043d\u043e \u043d\u0435 \u0442\u043e\u0439, \u0447\u0442\u043e \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u044e\u0442 \u0432 \u0425\u043e\u0433\u0432\u0430\u0440\u0442\u0441\u0435. \u0420\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0438\u043a\u0430, \u0442\u043e\u0447\u043d\u0435\u0435 <strong>\u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u0430 \u0444\u043e\u0440\u043c \u0432 Django<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u043a \u0436\u0435\u043b\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u0442, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>django-formtools<\/code> \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043e\u043b\u0448\u0435\u0431\u0441\u0442\u0432\u0430 \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435.<\/p>\n<p>\u0410 \u043f\u0440\u0438\u0447\u0435\u043c \u0442\u0443\u0442 \u043c\u0430\u0433\u0438\u044f? \u0423\u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h4>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b<\/h4>\n<p>\u041c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0440\u044f\u0434 \u0444\u0438\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043e\u043f\u044b\u0442.<\/p>\n<p>\u041c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b <strong>\u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044e\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u0438\u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u043b\u043a\u0438\u0435,<\/strong> \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0448\u0430\u0433\u0438. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u043c\u0435\u043d\u0435\u0435 \u0443\u0441\u0442\u0440\u0430\u0448\u0430\u044e\u0449\u0435\u0439 \u0438 \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0435\u0451 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0442\u043e\u0447\u043d\u043e \u0432\u0438\u0434\u044f\u0442, \u0433\u0434\u0435 \u043e\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0435\u0449\u0435 \u0448\u0430\u0433\u043e\u0432 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c.<\/p>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u0438<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u043b\u0435\u0432\u0430\u043d\u0442\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043f\u043e\u043b\u044f.<\/p>\n<p>\u041d\u0430 \u043c\u043e\u0431\u0438\u043b\u043a\u0430\u0445 \u043f\u0440\u043e\u043a\u0440\u0443\u0442\u043a\u0430 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e\u0439. <strong>\u041c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u043a\u0446\u0438\u0438<\/strong> \u043f\u043e \u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <code>django-formtools<\/code>:<\/p>\n<pre><code class=\"bash\">pip install django-formtools<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c<code>formtools<\/code> \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 Django:<\/p>\n<pre><code class=\"yaml\">INSTALLED_APPS = [     ...     'formtools',     ... ]<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>django-formtools<\/code> \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<h3>SessionWizardView \u0438 CookieWizardView<\/h3>\n<p>\u0414\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437-\u0437\u0430 \u0441\u043b\u043e\u0432\u0430 &#171;<em>Wizard<\/em>&#187; \u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u0438\u043c, \u043a\u0430\u043a\u043e\u0435 \u043e\u043d\u043e \u0435\u0441\u0442\u044c.<\/p>\n<p><code>django-formtools<\/code> \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0444\u043e\u0440\u043c: <code>SessionWizardView<\/code> \u0438 <code>CookieWizardView<\/code>. \u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u043f\u0440\u043e\u0442\u044f\u0436\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432.<\/p>\n<ul>\n<li>\n<p><code>SessionWizardView<\/code> <strong>\u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 \u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/strong> \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u043c\u0435\u0435\u043c \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0441\u0441\u0438\u0438 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.<\/p>\n<\/li>\n<li>\n<p><code>CookieWizardView<\/code> <strong>\u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043a\u0443\u043a\u0430\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/strong>. \u041c\u0435\u0442\u043e\u0434 \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0433\u0434\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u0435\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0435\u043d, \u0442.\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0431\u043e\u0440 \u043c\u0435\u0436\u0434\u0443 <code>SessionWizardView<\/code> \u0438 <code>CookieWizardView<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043a \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0414\u043b\u044f \u0441\u0442\u0430\u0440\u0442\u0430 \u0440\u0430\u0431\u043e\u0442 \u0441 <code>SessionWizardView<\/code>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u043e\u0440\u043c, \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0433\u0443 \u0432 \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u0444\u043e\u0440\u043c. \u0417\u0430\u0442\u0435\u043c \u044d\u0442\u0438 \u0444\u043e\u0440\u043c\u044b \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0441, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0442 <code>SessionWizardView<\/code>. \u0412 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>done<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0448\u0430\u0433\u043e\u0432 \u0444\u043e\u0440\u043c\u044b. \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 \u0411\u0414 \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0439 \u0444\u043e\u0440\u043c\u044b \u0441 <code>SessionWizardView<\/code>:<\/p>\n<pre><code class=\"python\">from django import forms from django.http import HttpResponseRedirect from formtools.wizard.views import SessionWizardView  class ContactForm1(forms.Form):     name = forms.CharField(max_length=100)  class ContactForm2(forms.Form):     age = forms.IntegerField()  class ContactWizard(SessionWizardView):     template_name = \"contact_form.html\"     form_list = [ContactForm1, ContactForm2]      def done(self, form_list, **kwargs):         form_data = [form.cleaned_data for form in form_list]         # \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445         return HttpResponseRedirect('\/finished\/')<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f <code>CookieWizardView<\/code> \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 <code>SessionWizardView<\/code>, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u0443\u043a\u0430\u0445, \u0430 \u043d\u0435 \u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 <code>CookieWizardView<\/code>:<\/p>\n<pre><code class=\"python\">from django import forms from formtools.wizard.views import CookieWizardView  class FeedbackForm1(forms.Form):     feedback = forms.CharField(widget=forms.Textarea)  class FeedbackForm2(forms.Form):     email = forms.EmailField()  class FeedbackWizard(CookieWizardView):     template_name = \"feedback_form.html\"     form_list = [FeedbackForm1, FeedbackForm2]      def done(self, form_list, **kwargs):         form_data = [form.cleaned_data for form in form_list]         # \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0442\u0437\u044b\u0432\u043e\u0432         return HttpResponseRedirect('\/feedback\/thanks\/')<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0434\u043b\u044f \u0444\u043e\u0440\u043c \u0432 \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0445 \u0432\u0438\u0437\u0430\u0440\u0434\u0430\u0445 Django \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 HTML-\u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041f\u043e \u0434\u0435\u0444\u043e\u043b\u0442\u0443 \u0432\u0441\u0435 \u0444\u043e\u0440\u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d <code>formtools\/wizard\/wizard_form.html<\/code>. \u041e\u0434\u043d\u0430\u043a\u043e, \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>template_name<\/code> \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <code>get_template_names()<\/code>. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 <code>wizard<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0440\u044f\u0434 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>wizard.form<\/code> \u2014 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0444\u043e\u0440\u043c\u044b \u0438\u043b\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0444\u043e\u0440\u043c \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u0443\u0441\u0442\u044b\u043c, \u0442\u0430\u043a \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps<\/code> \u2014 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0448\u0430\u0433\u0430\u0445: <\/p>\n<ul>\n<li>\n<p><code>wizard.steps.step0<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0448\u0430\u0433 (\u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u0441 \u043d\u0443\u043b\u044f).<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.step1<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0448\u0430\u0433 (\u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u044f \u0441 \u0435\u0434\u0438\u043d\u0438\u0446\u044b).<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.count<\/code> \u2014 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0448\u0430\u0433\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.first<\/code> \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.last<\/code> \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.current<\/code> \u2014 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.next<\/code> \u2014 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.prev<\/code> \u2014 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0448\u0430\u0433.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.index<\/code> \u2014 \u0438\u043d\u0434\u0435\u043a\u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<\/li>\n<li>\n<p><code>wizard.steps.all<\/code> \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432\u0438\u0437\u0430\u0440\u0434\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u044f\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f  <code>get_context_data()<\/code> \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u0430 <code>WizardView<\/code>.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0433\u043e \u0432\u0438\u0437\u0430\u0440\u0434\u0430:<\/p>\n<pre><code class=\"yaml\">{% extends \"base.html\" %} {% load i18n %}  {% block head %} {{ wizard.form.media }} {% endblock %}  {% block content %} &lt;p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}&lt;\/p> &lt;form action=\"\" method=\"post\">{% csrf_token %} &lt;table> {{ wizard.management_form }} {% if wizard.form.forms %}     {{ wizard.form.management_form }}     {% for form in wizard.form.forms %}         {{ form.as_table }}     {% endfor %} {% else %}     {{ wizard.form.as_table }} {% endif %} &lt;\/table> {% if wizard.steps.prev %} &lt;button name=\"wizard_goto_step\" type=\"submit\" value=\"{{ wizard.steps.first }}\">{% translate \"first step\" %}&lt;\/button> &lt;button name=\"wizard_goto_step\" type=\"submit\" value=\"{{ wizard.steps.prev }}\">{% translate \"prev step\" %}&lt;\/button> {% endif %} &lt;input type=\"submit\" value=\"{% translate \"submit\" %}\"\/> &lt;\/form> {% endblock %}<\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u043e \u044e\u0437\u0430\u0442\u044c <code>{{ wizard.management_form }}<\/code> \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0430\u0440\u0434 \u043c\u043e\u0433 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043c\u0435\u0436\u0434\u0443 \u0448\u0430\u0433\u0430\u043c\u0438. <\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 URL<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0432\u0438\u0437\u0430\u0440\u0434 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e URL Django. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0432\u0438\u0437\u0430\u0440\u0434\u0435. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>WizardView<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 URL \u0432 \u0444\u0430\u0439\u043b\u0435 <code>urls.py<\/code>. \u041c\u0435\u0442\u043e\u0434 <code>as_view()<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432\u0438\u0437\u0430\u0440\u0434\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0444\u043e\u0440\u043c \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438:<\/p>\n<pre><code class=\"python\">from django.urls import path from myapp.forms import ContactForm1, ContactForm2 from myapp.views import ContactWizard  urlpatterns = [     path('contact\/', ContactWizard.as_view([ContactForm1, ContactForm2])), ]<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u043e\u0440\u043c \u043a\u0430\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>form_list<\/code>:<\/p>\n<pre><code class=\"python\">class ContactWizard(WizardView):     form_list = [ContactForm1, ContactForm2]<\/code><\/pre>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0435. \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u0448\u0430\u0433\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0438 \u043e\u043f\u043b\u0430\u0442\u044b. \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0448\u0430\u0433\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u043f\u043b\u0430\u0442\u044b. \u0415\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u0430 \u043e\u043f\u043b\u0430\u0442\u0430 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u043e\u0439, \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0440\u0435\u0434\u0438\u0442\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u044b. \u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0448\u0430\u0433\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e\u043a\u0443\u043f\u043a\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0432\u0438\u0437\u0430\u0440\u0434\u0430:<\/p>\n<pre><code class=\"python\">from django.http import HttpResponseRedirect from formtools.wizard.views import SessionWizardView  FORMS = [(\"address\", myapp.forms.AddressForm),          (\"paytype\", myapp.forms.PaymentChoiceForm),          (\"cc\", myapp.forms.CreditCardForm),          (\"confirmation\", myapp.forms.OrderForm)]  TEMPLATES = {\"address\": \"checkout\/billingaddress.html\",              \"paytype\": \"checkout\/paymentmethod.html\",              \"cc\": \"checkout\/creditcard.html\",              \"confirmation\": \"checkout\/confirmation.html\"}  class OrderWizard(SessionWizardView):     def get_template_names(self):         return [TEMPLATES[self.steps.current]]      def done(self, form_list, **kwargs):         do_something_with_the_form_data(form_list)         return HttpResponseRedirect('\/page-to-redirect-to-when-done\/')<\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 <code>urls.py<\/code> \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">urlpatterns = [     path('checkout\/', OrderWizard.as_view(FORMS, condition_dict={'cc': pay_by_credit_card})), ]<\/code><\/pre>\n<p><code>condition_dict<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043a\u0430\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 <code>as_view()<\/code> \u0438\u043b\u0438 \u043a\u0430\u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>condition_dict<\/code>:<\/p>\n<pre><code class=\"python\">class OrderWizard(WizardView):     condition_dict = {'cc': pay_by_credit_card}<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 <code>get_template_names()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0434\u0438\u043d \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<h4>\u041f\u0440\u043e\u0447\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b WizardView<\/h4>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <code>done()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0432\u0441\u0435\u0445 \u0448\u0430\u0433\u043e\u0432, \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u0438\u0437\u0430\u0440\u0434\u0430 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044d\u0442\u0430\u043f\u0430\u0445.<\/p>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0444\u043e\u0440\u043c\u0430\u043c\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0448\u0430\u0433\u0430\u0445. \u041f\u0440\u0435\u0444\u0438\u043a\u0441 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0438\u043c\u0435\u043d\u0438 \u0448\u0430\u0433\u0430, \u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0444\u043e\u0440\u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f:<\/p>\n<pre><code class=\"python\">get_form_prefix(step=None, form=None)<\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>initial<\/code> \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430. \u0415\u0441\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0438\u0437\u0430\u0440\u0434\u0430, \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c:<\/p>\n<pre><code class=\"python\">get_form_initial(step)<\/code><\/pre>\n<p><code>get_form_kwargs(step)<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u0444\u043e\u0440\u043c\u044b \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u0448\u0430\u0433\u0435.<\/p>\n<p><code>get_form_instance(step)<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u0448\u0430\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>ModelForm<\/code>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043c\u043e\u0434\u0435\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>instance<\/code> \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>ModelForm<\/code> \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0434\u043b\u044f \u0448\u0430\u0433\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043f. \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0448\u0430\u0433\u043e\u0432. \u041c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0448\u0430\u0433 \u0444\u043e\u0440\u043c\u044b:<\/p>\n<pre><code class=\"python\">def get_context_data(self, form, **kwargs):     context = super().get_context_data(form=form, **kwargs)     if self.steps.current == 'my_step_name':       <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-377675","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/377675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=377675"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/377675\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=377675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=377675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=377675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}