{"id":158107,"date":"2012-11-10T16:41:04","date_gmt":"2012-11-10T12:41:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=158107"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=158107","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u0444\u043e\u0440\u043c Django \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432\u00a0\u0441\u043e\u0441\u0442\u0430\u0432 Django \u0432\u0445\u043e\u0434\u0438\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u00a0\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f html-\u0444\u043e\u0440\u043c. \u041a\u043e\u0433\u0434\u0430-\u0442\u043e \u0441\u00a0Django \u0432\u00a0\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0448\u043b\u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0444\u043e\u0440\u043c, \u043d\u043e\u00a0\u043f\u043e\u0442\u043e\u043c \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u0430. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0442\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041d\u043e\u00a0\u0438\u00a0\u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0\u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u00a0\u044d\u0442\u043e\u043c \u044f\u00a0\u0438\u00a0\u0445\u043e\u0447\u0443 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0437\u0430\u0434\u0430\u0447\u0430. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u044f\u0442 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u00a0\u0441\u0430\u0439\u0442\u0430\u0445 \u0441\u0432\u043e\u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b \u0438\u00a0\u0434\u0440\u0443\u0433\u0443\u044e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041f\u0440\u0438\u0447\u0435\u043c, \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043e\u043d\u0438 \u0445\u043e\u0442\u044f\u0442, \u043d\u0435\u00a0\u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u044f\u0441\u044c \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0435\u0451\u00a0\u0432\u0432\u0435\u0441\u0442\u0438: 8(908)1271669 \u0438\u043b\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, 908\u00a0127\u00a016\u00a069. \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0438 \u0441\u0430\u0439\u0442\u0430 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u044f\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043d\u044b\u0435: (+7\u00a0495)\u00a0722-16-25, +7\u00a0968\u00a0127-31-32. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u00a0\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u00a0\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0435\u0437 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f. \u0412\u00a0\u043f\u043e\u043b\u0435, \u043f\u0440\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u00a0\u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0424\u043e\u0440\u043c\u0430\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u00a011\u00a0\u0446\u0438\u0444\u0440, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u0440\u0430\u0442\u043a\u043e \u0438\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u043e\u0440\u043c. \u0424\u043e\u0440\u043c\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437\u00a0\u043a\u043b\u0430\u0441\u0441\u0430 Form \u0438\u00a0\u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u043e\u043b\u0435\u0439, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432\u00a0\u0444\u043e\u0440\u043c\u0443 (\u043a\u043b\u0430\u0441\u0441 Field). \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0444\u043e\u0440\u043c\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044c initial \u2014 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439. \u0415\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e\u00a0ModelForm, \u0441\u043b\u043e\u0432\u0430\u0440\u044c initial \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u0437\u00a0\u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0444\u043e\u0440\u043c\u044b \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043c\u043e\u0434\u0435\u043b\u0438. \u041a\u043b\u0430\u0441\u0441 Form \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u0441\u0430\u043c\u043e\u0439 html-\u0444\u043e\u0440\u043c\u044b. \u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0437\u0430\u0432\u0435\u0434\u0443\u044e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u0430 BoundField, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044f \u0438\u00a0\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432\u00a0\u0444\u043e\u0440\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u0421\u0430\u043c html-\u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0432\u0438\u0434\u0436\u0435\u0442\u044b (\u043a\u043b\u0430\u0441\u0441 Widget). \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0443 \u0444\u043e\u0440\u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u0430\u0440\u044c data \u2014 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 POST-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0432\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u00a0\u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0432\u0435\u0440\u043d\u043e. \u0412\u00a0\u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0444\u043e\u0440\u043c\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u0440\u0430\u0437, \u043d\u043e\u00a0\u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u043d\u0435\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c initial, \u0430\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430 data.<\/p>\n<p>  \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0443\u00a0\u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u043e\u0440\u043c\u044b \u0435\u0441\u0442\u044c \u0442\u0440\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430: \u0438\u0437\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u0447\u0435\u0440\u0435\u0437 initial \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0444\u043e\u0440\u043c\u044b), \u043e\u0442\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445) \u0438\u00a0\u043e\u0442\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043a\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e (\u0435\u0441\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b). \u0427\u0442\u043e\u00a0\u0436\u0435, \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u041d\u0443\u0436\u043d\u043e \u0432\u043a\u043b\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0432\u00a0\u043f\u0435\u0440\u0432\u044b\u0439 \u0438\u00a0\u0442\u0440\u0435\u0442\u0438\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u00a0\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u044f \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u0447\u043d\u0435\u043c \u0441\u00a0\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0431\u043e\u043b\u0432\u0430\u043d\u043a\u0443 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u043e\u043b\u044f. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043e \u043e\u0442\u00a0CharField.<\/p>\n<pre><code class=\"python\">class MultiplePhoneFormField(forms.CharField):     # \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0444\u043e\u0440\u043c\u044b.     phone_code = '' <\/code><\/pre>\n<p>  \u0412 <a href=\"https:\/\/docs.djangoproject.com\/en\/1.4\/ref\/forms\/validation\/\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432\u00a0\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. to_python() \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043a\u00a0\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0443 \u0434\u0430\u043d\u043d\u044b\u0445. \u041d\u043e\u00a0\u0443\u00a0\u043d\u0430\u0441 \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u0441\u0442\u0440\u043e\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u00a0\u0431\u0443\u0434\u0435\u043c. \u0414\u0430\u043b\u0435\u0435 \u043c\u0435\u0442\u043e\u0434\u044b validate() \u0438\u00a0run_validators(). \u0421\u043b\u0443\u0436\u0430\u0442 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043d\u043e\u00a0\u043d\u0435\u00a0\u043c\u043e\u0433\u0443\u0442 \u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0442\u043e\u0436\u0435 \u043d\u0435\u00a0\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442. \u041e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 clean() \u0443\u00a0\u043f\u043e\u043b\u044f. \u0412 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043d\u00a0\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0432\u00a0\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u00a0\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0417\u043d\u0430\u0447\u0438\u0442, \u0442\u0443\u0442 \u0438\u00a0\u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u043a\u043e\u0434.<\/p>\n<pre><code class=\"python\">    def clean(self, phones):         phones = super(MultiplePhoneFormField, self).clean(phones)         cleaned_phones = []         for phone in phones.split(','):             phone = re.sub(r'[\\s\u00a0+.()\\-]', '', phone)             if not phone:                 continue             if not phone.isdigit():                 raise ValidationError(u'\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0446\u0438\u0444\u0440\u044b.')             if len(phone) == 11:                 pass             elif len(phone) == 10:                 phone = '7' + phone             elif len(self.phone_code + phone) == 11:                 phone = self.phone_code + phone             else:                 raise ValidationError(u'\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0446\u0438\u0444\u0440.')             cleaned_phones.append(phone)         return ' '.join(cleaned_phones) <\/code><\/pre>\n<p>  \u041d\u0435\u00a0\u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u043c\u0435\u0440, \u0434\u0443\u043c\u0430\u044e \u0438\u00a0\u0442\u0430\u043a \u0432\u0441\u0435 \u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043e\u0442\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u0412\u00a0\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044f MultiEmailField, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0441\u043f\u0438\u0441\u043e\u043a email-\u0430\u0434\u0440\u0435\u0441\u043e\u0432. \u041d\u043e\u00a0\u0432\u043e\u0442 \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u043d\u043e \u044d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u043d\u0435\u00a0\u0441\u043a\u0430\u0437\u0430\u043d\u043e. \u0412\u0438\u0434\u0438\u043c\u043e, \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u043d\u0430\u00a0\u043f\u043b\u0435\u0447\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0435\u0433\u043e \u0444\u043e\u0440\u043c\u0443. \u0414\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0442\u043e\u0436\u0435 \u043d\u0435\u0442. \u041d\u043e\u00a0\u043c\u044b\u00a0\u043d\u0435\u00a0\u0433\u043e\u0440\u0434\u044b\u0435, \u043c\u043e\u0436\u0435\u043c \u0438\u00a0\u0432\u00a0\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c.<\/p>\n<p>  \u0423\u00a0\u043a\u043b\u0430\u0441\u0441\u0430 BoundField \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 as_widget(), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c, \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u0441\u0432\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 value(). \u0418\u043c\u0435\u043d\u043d\u043e \u0432\u00a0\u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 data \u0438\u043b\u0438 initial. \u0418\u00a0\u0442\u0443\u0442 \u043d\u0430\u0441 \u0436\u0434\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437\u00a0initial, \u0442\u043e \u043f\u043e\u043b\u044e \u043d\u0438\u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u0432\u00a0\u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u00a0\u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u041c\u0435\u0442\u043e\u0434 value() \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 self.form.initial.get(self.name) \u0438\u00a0\u043f\u043e\u0442\u043e\u043c \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442\u00a0\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0438\u0445\u00a0\u043c\u0435\u0442\u043e\u0434\u0443 prepare_value() \u043f\u043e\u043b\u044f. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043e\u0434\u0438\u043d \u0438\u00a0\u0442\u043e\u0442 \u0436\u0435\u00a0\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440, \u0432\u00a0\u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u00ab\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435\u00bb \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u041b\u0438\u0431\u043e \u044f\u00a0\u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u00a0\u043f\u043e\u043d\u044f\u043b, \u043b\u0438\u0431\u043e \u0414\u0436\u0430\u043d\u0433\u043e\u0432\u0441\u043a\u0438\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0442\u0430\u043a, \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f\u00a0\u0432\u044b\u0432\u043e\u0434\u0430 \u0432\u00a0\u0444\u043e\u0440\u043c\u0435. \u0412\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u0435 initial \u0432\u00a0\u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u044b \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043a\u043e\u00a0\u0432\u0441\u0442\u0430\u0432\u043a\u0435 \u0432\u00a0html.<\/p>\n<p>  \u00ab\u041d\u043e\u00a0\u043f\u043e\u0441\u0442\u043e\u0439\u0442\u0435, \u0430\u00a0\u043a\u0430\u043a \u0436\u0435\u00a0\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 DatetimeField, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 datetime \u0432\u00a0\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 initial?\u00bb \u2014 \u0441\u043a\u0430\u0436\u0435\u0442\u0435 \u0432\u044b. \u0412\u043e\u0442 \u0438 \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u00a0\u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u00a0\u043c\u0435\u0442\u043e\u0434 render() \u0432\u0438\u0434\u0436\u0435\u0442\u0430 DateTimeInput, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u00a0\u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u0433\u043e \u0432\u00a0\u0441\u0432\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 _format_value(). \u0418\u00a0\u0443\u0436\u0435 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u0435\u0441\u043b\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f datetime, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0432\u00a0\u0441\u0442\u0440\u043e\u043a\u0443. \u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0432\u00a0\u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u0437\u00a0\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u00a0\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0444\u043e\u0440\u043c\u044b, \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439. \u0412\u00a0\u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u044d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430.<\/p>\n<p>  \u0422\u0435\u043c \u043d\u0435\u00a0\u043c\u0435\u043d\u0435\u0435, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u00a0\u043e\u043d\u043e \u0435\u0441\u0442\u044c. \u0415\u0441\u043b\u0438 \u0435\u0449\u0435 \u0440\u0430\u0437 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430\u00a0\u043c\u0435\u0442\u043e\u0434 BoundField.value(), \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u043e\u0435 \u043e\u0442\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434 bound_data(). \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u00a0\u043c\u0435\u0442\u043e\u0434\u0435 prepare_value(), \u043a\u0443\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435, \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0433\u043e \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c. \u0422\u0430\u043a \u0438\u00a0\u0441\u0434\u0435\u043b\u0430\u0435\u043c.<\/p>\n<pre><code class=\"python\">class ValueFromDatadict(unicode):     pass  class MultiplePhoneFormField(forms.CharField):     # \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0444\u043e\u0440\u043c\u044b.     phone_code = ''      def bound_data(self, data, initial):         return ValueFromDatadict(data)      def prepare_value(self, value):         if not value or isinstance(value, ValueFromDatadict):             return value         return return ', '.join(format_phones(value, code=self.phone_code)) <\/code><\/pre>\n<p>  \u0423\u0440\u0430! \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u00a0\u0444\u043e\u0440\u043c\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u0438\u00a0\u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043e\u0442\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b.<\/p>\n<pre><code class=\"python\">def format_phones(phones, code=None):     for phone in filter(None, phones.split(' ')):         if len(phone) != 11:             # \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d.             pass         elif phone[0:4] == '8800':             # 8 800 100-31-32             phone = u'8\u00a0800\u00a0%s-%s-%s' % (phone[4:7], phone[7:9], phone[9:11])         elif code and phone.startswith(code):             # (+7 351) 722-16-25             # (+7 3512) 22-16-25             phone = phone[len(code):]             phone = u'(+%s\u00a0%s)\u00a0%s-%s-%s' % (code[0], code[1:], phone[:-4], phone[-4:-2], phone[-2:])         else:             # +7 968 127-31-32             phone = u'+%s\u00a0%s\u00a0%s-%s-%s' % (phone[0], phone[1:4], phone[4:7], phone[7:9], phone[9:11])         yield phone <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u00a0\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0444\u043e\u0440\u043c\u044b \u043a\u043e\u0434 \u0433\u043e\u0440\u043e\u0434\u0430, \u043a\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<pre><code class=\"python\">class RestaurantForm(forms.ModelForm):     phone = MultiplePhoneFormField(label=u'\u0422\u0435\u043b\u0435\u0444\u043e\u043d', required=False,         help_text=u'\u041c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u043f\u044f\u0442\u0443\u044e.')      def __init__(self, *args, **kwargs):         super(RestaurantForm, self).__init__(*args, **kwargs)         if self.instance:             self.fields['phone'].phone_code = self.instance.city.phone_code <\/code><\/pre>\n<p>  \u041d\u0443\u00a0\u0430\u00a0\u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432 \u043d\u0430\u00a0\u0441\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440:<\/p>\n<pre><code class=\"python\">@register.filter def format_phones_with_code(phones, code):     return mark_safe(u', '.join([u'&lt;nobr&gt;%s&lt;\/nobr&gt;' % phone         for phone in format_phones(phones, code)])) <\/code><\/pre>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0442\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0448\u0438\u0442\u044c \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u041d\u043e\u00a0\u044f\u0432\u043d\u043e \u043d\u0435\u00a0\u0431\u0435\u0437 \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439. \u0422\u043e\u00a0\u0436\u0435\u00a0\u0441\u0430\u043c\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438\u00a0\u043e\u00a0\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043f\u043e\u043b\u0435\u0439, \u0438\u0434\u0443\u0449\u0438\u0445 \u0432\u00a0\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441\u00a0Django. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u00a0\u043c\u0435\u0442\u043e\u0434\u0435 to_python() \u0442\u043e\u0433\u043e \u0436\u0435\u00a0\u043f\u043e\u043b\u044f DateTimeField, \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u00a0\u0442\u043e, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0442\u0438\u043f\u0430 datetime. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434 to_python() \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0438\u0437\u00a0\u0441\u043b\u043e\u0432\u0430\u0440\u044f data. \u0412\u00a0<a href=\"https:\/\/docs.djangoproject.com\/en\/1.4\/ref\/forms\/api\/#django.forms.Form\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a\u00a0\u0444\u043e\u0440\u043c\u0430\u043c<\/a> \u043f\u0440\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f data \u044f\u0432\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e: \u00abThese will usually be\u00a0strings, but there&#8217;s no\u00a0requirement that they be\u00a0strings\u00bb. \u0412\u0438\u0434\u0438\u043c\u043e, \u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u043c\u044b\u0441\u043b \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0447\u0435\u0433\u043e-\u0442\u043e \u0438\u043d\u043e\u0433\u043e, \u043d\u0435\u0436\u0435\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0432\u0432\u043e\u0434\u0430, \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u0438\u0437\u00a0post-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u043e \u0442\u0430\u043a\u0430\u044f \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c \u0432\u043d\u043e\u0441\u0438\u0442 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0438\u00a0\u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439, \u0430\u00a0\u043d\u0435\u00a0\u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439.    \t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/158107\/\"> http:\/\/habrahabr.ru\/post\/158107\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432\u00a0\u0441\u043e\u0441\u0442\u0430\u0432 Django \u0432\u0445\u043e\u0434\u0438\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u00a0\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f html-\u0444\u043e\u0440\u043c. \u041a\u043e\u0433\u0434\u0430-\u0442\u043e \u0441\u00a0Django \u0432\u00a0\u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0448\u043b\u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0444\u043e\u0440\u043c, \u043d\u043e\u00a0\u043f\u043e\u0442\u043e\u043c \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d\u0430. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0442\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041d\u043e\u00a0\u0438\u00a0\u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u00a0\u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u00a0\u044d\u0442\u043e\u043c \u044f\u00a0\u0438\u00a0\u0445\u043e\u0447\u0443 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0437\u0430\u0434\u0430\u0447\u0430. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u044f\u0442 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u00a0\u0441\u0430\u0439\u0442\u0430\u0445 \u0441\u0432\u043e\u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b \u0438\u00a0\u0434\u0440\u0443\u0433\u0443\u044e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u041f\u0440\u0438\u0447\u0435\u043c, \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043e\u043d\u0438 \u0445\u043e\u0442\u044f\u0442, \u043d\u0435\u00a0\u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u044f\u0441\u044c \u043e\u00a0\u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0435\u0451\u00a0\u0432\u0432\u0435\u0441\u0442\u0438: 8(908)1271669 \u0438\u043b\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, 908\u00a0127\u00a016\u00a069. \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0438 \u0441\u0430\u0439\u0442\u0430 \u043e\u0447\u0435\u043d\u044c \u043b\u044e\u0431\u044f\u0442 \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u044b, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u043d\u044b\u0435: (+7\u00a0495)\u00a0722-16-25, +7\u00a0968\u00a0127-31-32. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u00a0\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u00a0\u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0435\u0437 \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f. \u0412\u00a0\u043f\u043e\u043b\u0435, \u043f\u0440\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044f\u00a0\u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430. \u0424\u043e\u0440\u043c\u0430\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437\u00a011\u00a0\u0446\u0438\u0444\u0440, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c.  <\/p>\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-158107","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158107","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=158107"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/158107\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=158107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=158107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=158107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}