├── request-handling ├── __init__.py ├── landing │ ├── __init__.py │ ├── app │ │ ├── __init__.py │ │ ├── urls.py │ │ ├── templates │ │ │ ├── index.html │ │ │ ├── landing_alternate.html │ │ │ ├── stats.html │ │ │ └── _base.html │ │ ├── wsgi.py │ │ └── views.py │ ├── requirements.txt │ ├── res │ │ ├── stats.png │ │ ├── test.png │ │ └── original.png │ ├── static │ │ ├── img │ │ │ ├── background1.jpg │ │ │ ├── background2.jpg │ │ │ └── animal-blur-close-up-840326.jpg │ │ ├── js │ │ │ └── init.js │ │ └── css │ │ │ └── style.css │ └── manage.py ├── file_server │ ├── __init__.py │ ├── app │ │ ├── __init__.py │ │ ├── wsgi.py │ │ ├── urls.py │ │ ├── templates │ │ │ ├── file_content.html │ │ │ ├── _base.html │ │ │ └── index.html │ │ └── views.py │ ├── requirements.txt │ ├── res │ │ └── result.gif │ ├── files │ │ ├── server.03 │ │ ├── server.01 │ │ └── server.02 │ └── manage.py ├── pagination │ ├── __init__.py │ ├── app │ │ ├── __init__.py │ │ ├── urls.py │ │ ├── wsgi.py │ │ ├── views.py │ │ └── templates │ │ │ ├── index.html │ │ │ └── _base.html │ ├── requirements.txt │ ├── res │ │ └── result.png │ ├── data-398-2018-08-30.csv │ ├── manage.py │ └── README.md └── README.md ├── site-form-works ├── review │ ├── app │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ └── 0001_initial.py │ │ ├── apps.py │ │ ├── forms.py │ │ ├── admin.py │ │ ├── models.py │ │ └── views.py │ ├── product_review │ │ ├── __init__.py │ │ ├── settings_local_sample.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── .gitignore │ ├── docs │ │ ├── list.png │ │ └── product.png │ ├── static │ │ └── css │ │ │ └── review.css │ ├── images │ │ └── 2018 │ │ │ └── 09 │ │ │ └── 29 │ │ │ ├── gkehh.jpg │ │ │ └── 46511d3ce6fdeb66a99216c6ae5dd415.jpg │ ├── products │ │ └── 2018 │ │ │ └── 09 │ │ │ └── 29 │ │ │ └── gkehh.jpg │ ├── templates │ │ ├── app │ │ │ ├── product_list.html │ │ │ └── product_detail.html │ │ └── base.html │ └── manage.py ├── car_admin │ ├── app │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ ├── 0002_review_title.py │ │ │ └── 0001_initial.py │ │ ├── tests.py │ │ ├── views.py │ │ ├── apps.py │ │ ├── forms.py │ │ ├── admin.py │ │ └── models.py │ ├── car_admin │ │ ├── __init__.py │ │ ├── settings_local_sample.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── .gitignore │ ├── docs │ │ ├── admin_car.png │ │ ├── admin_review.png │ │ └── ckeditor_full.png │ ├── templates │ │ └── app │ │ │ └── calc.html │ └── manage.py ├── credit_calc │ ├── app │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── views.py │ │ └── forms.py │ ├── credit_calc │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── .gitignore │ ├── static │ │ └── css │ │ │ └── calc.css │ ├── docs │ │ └── calc.png │ ├── manage.py │ └── templates │ │ └── app │ │ └── calc.html ├── avia_scanner │ ├── app │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ └── 0001_initial.py │ │ ├── apps.py │ │ ├── models.py │ │ ├── admin.py │ │ ├── forms.py │ │ ├── templates │ │ │ └── widget │ │ │ │ └── ajax_input_widget.html │ │ ├── widgets.py │ │ └── views.py │ ├── avia_scanner │ │ ├── __init__.py │ │ ├── settings_local_sample.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── .gitignore │ ├── docs │ │ ├── datepicker.png │ │ ├── citypicker_ajax.png │ │ └── citypicker_standart.png │ ├── manage.py │ ├── templates │ │ └── app │ │ │ └── ticket_page.html │ └── static │ │ └── css │ │ └── avia.css └── README.md ├── databases ├── phone_comparison │ ├── main │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── phones │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── admin.py │ │ ├── tests.py │ │ ├── apps.py │ │ └── views.py │ ├── requirements.txt │ ├── static │ │ └── css │ │ │ └── style.css │ ├── res │ │ └── catalog.png │ ├── templates │ │ ├── catalog.html │ │ └── base.html │ └── manage.py ├── work_with_database │ ├── main │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── phones │ │ ├── __init__.py │ │ ├── management │ │ │ ├── __init__.py │ │ │ └── commands │ │ │ │ ├── __init__.py │ │ │ │ └── import_phones.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── models.py │ │ └── views.py │ ├── requirements.txt │ ├── res │ │ └── catalog.png │ ├── static │ │ └── css │ │ │ └── style.css │ ├── templates │ │ ├── product.html │ │ ├── catalog.html │ │ └── base.html │ ├── phones.csv │ └── manage.py ├── models_list_displaying │ ├── books │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ └── 0001_initial.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── views.py │ │ ├── converters.py │ │ ├── admin.py │ │ └── models.py │ ├── main │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── res │ │ ├── catalog_1.png │ │ └── catalog_2.png │ ├── static │ │ └── css │ │ │ └── style.css │ ├── fixtures │ │ └── books.json │ ├── manage.py │ └── templates │ │ ├── books │ │ └── books_list.html │ │ └── base.html └── README.md ├── databases_2 ├── orm_query │ ├── articles │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── apps.py │ │ ├── urls.py │ │ ├── admin.py │ │ ├── views.py │ │ └── models.py │ ├── website │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── static │ │ └── css │ │ │ └── 3-col-portfolio.css │ ├── manage.py │ ├── README.md │ └── templates │ │ └── articles │ │ ├── news.html │ │ └── base.html ├── m2m-relations │ ├── articles │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ └── 0001_initial.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── urls.py │ │ ├── admin.py │ │ ├── views.py │ │ └── models.py │ ├── website │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── res │ │ ├── base.png │ │ ├── admin.gif │ │ ├── admin.png │ │ ├── with_tags.png │ │ ├── admin_error_1.png │ │ └── admin_error_2.png │ ├── media │ │ ├── th_1488217075_CVC0Ltk.jpg │ │ ├── th_1521804489_cfyJCMV.jpg │ │ └── th_946876594_EntghVT.jpg │ ├── static │ │ └── css │ │ │ └── 3-col-portfolio.css │ ├── manage.py │ └── templates │ │ └── articles │ │ ├── news.html │ │ └── base.html ├── orm_migrations │ ├── school │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── apps.py │ │ ├── urls.py │ │ ├── admin.py │ │ ├── views.py │ │ └── models.py │ ├── website │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── media │ │ ├── th_1488217075_CVC0Ltk.jpg │ │ ├── th_1521804489_cfyJCMV.jpg │ │ └── th_946876594_EntghVT.jpg │ ├── templates │ │ └── school │ │ │ └── students_list.html │ ├── static │ │ └── css │ │ │ └── 3-col-portfolio.css │ └── manage.py └── README.md ├── dynamic-templates ├── task1 │ ├── app │ │ ├── __init__.py │ │ ├── views.py │ │ ├── wsgi.py │ │ ├── templates │ │ │ └── inflation.html │ │ └── urls.py │ ├── requirements.txt │ ├── example.png │ └── manage.py ├── task2 │ ├── app │ │ ├── __init__.py │ │ ├── templatetags │ │ │ ├── __init__.py │ │ │ └── app_tags.py │ │ ├── static │ │ │ ├── ii.jpg │ │ │ ├── imac.jpg │ │ │ ├── mac.jpg │ │ │ └── steve.jpg │ │ ├── wsgi.py │ │ ├── views.py │ │ ├── urls.py │ │ └── templates │ │ │ └── app │ │ │ └── home.html │ ├── requirements.txt │ ├── manage.py │ └── README.md ├── task3 │ ├── app │ │ ├── __init__.py │ │ ├── templatetags │ │ │ ├── __init__.py │ │ │ └── news_filters.py │ │ ├── wsgi.py │ │ ├── views.py │ │ └── urls.py │ ├── requirements.txt │ └── manage.py └── README.md ├── first-project ├── first_project │ ├── app │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── tests.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── templates │ │ │ └── app │ │ │ │ └── home.html │ │ └── views.py │ ├── first_project │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ └── manage.py └── README.md ├── creating-project ├── application │ ├── app │ │ ├── __init__.py │ │ ├── templatetags │ │ │ ├── __init__.py │ │ │ └── app_tags.py │ │ ├── wsgi.py │ │ ├── urls.py │ │ └── views.py │ ├── requirements.txt │ ├── static │ │ └── css │ │ │ └── style.css │ ├── phones.csv │ ├── manage.py │ └── templates │ │ ├── base.html │ │ └── table.html ├── project │ ├── requirements.txt │ ├── moscow_bus_stations.csv │ ├── static │ │ └── css │ │ │ └── style.css │ └── templates │ │ └── base.html ├── cli_and_doc │ └── requirements.txt └── README.md ├── django-testing ├── django_testing │ ├── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ └── students │ │ │ ├── __init__.py │ │ │ └── test_courses_api.py │ ├── students │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ ├── 0002_auto_20201101_2359.py │ │ │ └── 0001_initial.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── serializers.py │ │ ├── models.py │ │ ├── filters.py │ │ └── views.py │ ├── django_testing │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── pytest.ini │ ├── requirements-dev.txt │ ├── requirements.txt │ └── manage.py └── README.md ├── drf-intro ├── simple_crud │ ├── measurements │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── serializers.py │ │ ├── apps.py │ │ ├── views.py │ │ └── models.py │ ├── simple_crud │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ └── manage.py └── README.md ├── requirements.txt ├── site-personalization ├── sessions │ ├── game │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── admin.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── views.py │ │ └── models.py │ ├── main │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── res │ │ ├── screen_1.png │ │ ├── screen_2.png │ │ ├── screen_3.png │ │ └── screen_4.png │ ├── static │ │ └── css │ │ │ └── style.css │ ├── templates │ │ ├── home.html │ │ └── base.html │ └── manage.py ├── paid_content │ ├── main │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── articles │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── admin.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── models.py │ │ └── views.py │ ├── requirements.txt │ ├── static │ │ └── css │ │ │ └── style.css │ ├── res │ │ ├── articles.png │ │ ├── free_article.png │ │ └── paid_article.png │ ├── templates │ │ ├── article.html │ │ ├── articles.html │ │ └── base.html │ └── manage.py ├── auth_and_reg_users │ ├── auth │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── admin.py │ │ ├── tests.py │ │ ├── apps.py │ │ └── views.py │ ├── main │ │ ├── __init__.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── res │ │ ├── screen_1.png │ │ ├── screen_2.png │ │ ├── screen_3.png │ │ ├── screen_4.png │ │ └── screen_5.png │ ├── templates │ │ ├── signup.html │ │ ├── home.html │ │ └── base.html │ ├── static │ │ └── css │ │ │ └── style.css │ └── manage.py └── README.md ├── drf-auth-and-validation ├── api_with_restrictions │ ├── advertisements │ │ ├── __init__.py │ │ ├── migrations │ │ │ ├── __init__.py │ │ │ └── 0001_initial.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── filters.py │ │ ├── views.py │ │ └── models.py │ ├── api_with_restrictions │ │ ├── __init__.py │ │ ├── asgi.py │ │ ├── wsgi.py │ │ └── urls.py │ ├── requirements.txt │ ├── screenshots │ │ ├── success.png │ │ ├── bad_token.png │ │ ├── date_filter.png │ │ └── validation_error.png │ ├── manage.py │ └── requests-examples.http └── README.md ├── .gitignore ├── README.md └── HOW_TO_WORK.md /request-handling/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /request-handling/landing/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/review/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/phone_comparison/main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/orm_query/articles/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/orm_query/website/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dynamic-templates/task1/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dynamic-templates/task2/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dynamic-templates/task3/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /first-project/first_project/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /request-handling/file_server/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /request-handling/landing/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /request-handling/pagination/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /request-handling/pagination/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/car_admin/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /creating-project/application/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/phone_comparison/phones/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/work_with_database/main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/work_with_database/phones/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/website/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/school/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/website/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /django-testing/django_testing/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /django-testing/django_testing/tests/conftest.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/measurements/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/simple_crud/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /request-handling/file_server/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | pytz==2018.5 -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/car_admin/car_admin/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/sessions/game/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/sessions/main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/models_list_displaying/main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/orm_query/articles/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /django-testing/django_testing/students/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dynamic-templates/task2/app/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dynamic-templates/task3/app/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /first-project/first_project/first_project/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/avia_scanner/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/car_admin/app/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/credit_calc/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/review/app/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/review/product_review/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/paid_content/main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /creating-project/application/app/templatetags/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/phone_comparison/phones/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/work_with_database/phones/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/work_with_database/phones/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/school/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /django-testing/django_testing/django_testing/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /django-testing/django_testing/tests/students/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/measurements/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dynamic-templates/task1/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /dynamic-templates/task2/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /first-project/first_project/app/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/app/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/review/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/auth/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/paid_content/articles/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/sessions/game/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /django-testing/django_testing/students/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /first-project/first_project/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /request-handling/file_server/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /request-handling/landing/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /request-handling/pagination/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /databases/work_with_database/phones/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dynamic-templates/task3/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==2.2.13 2 | requests -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/auth/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/paid_content/articles/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-personalization/paid_content/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /site-personalization/sessions/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/measurements/serializers.py: -------------------------------------------------------------------------------- 1 | # TODO: опишите сериализаторы -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/api_with_restrictions/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | django_select2 3 | -------------------------------------------------------------------------------- /site-personalization/sessions/game/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | -------------------------------------------------------------------------------- /creating-project/project/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | -------------------------------------------------------------------------------- /databases/phone_comparison/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | -------------------------------------------------------------------------------- /creating-project/application/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | -------------------------------------------------------------------------------- /creating-project/cli_and_doc/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | -------------------------------------------------------------------------------- /databases/work_with_database/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | -------------------------------------------------------------------------------- /creating-project/application/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | font-weight: bold; 3 | } 4 | -------------------------------------------------------------------------------- /databases/models_list_displaying/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | -------------------------------------------------------------------------------- /site-personalization/paid_content/articles/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | 4 | -------------------------------------------------------------------------------- /django-testing/django_testing/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | DJANGO_SETTINGS_MODULE = django_testing.settings -------------------------------------------------------------------------------- /site-form-works/avia_scanner/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.pyc 3 | 4 | settings_local.py 5 | db.sqlite3 6 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.pyc 3 | 4 | settings_local.py 5 | db.sqlite3 6 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | Pillow==8.3.2 4 | -------------------------------------------------------------------------------- /databases_2/orm_query/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | psycopg2-binary==2.8.6 3 | django-debug-toolbar 4 | -------------------------------------------------------------------------------- /site-form-works/car_admin/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==2.2.13 2 | django-ckeditor==5.6.1 3 | pillow==6.2.0 4 | -------------------------------------------------------------------------------- /site-form-works/review/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.pyc 3 | media/ 4 | 5 | settings_local.py 6 | db.sqlite3 7 | -------------------------------------------------------------------------------- /databases/phone_comparison/phones/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /first-project/first_project/app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /first-project/first_project/app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /site-form-works/car_admin/app/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /site-form-works/car_admin/app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /databases/phone_comparison/phones/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /databases/phone_comparison/phones/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /databases/phone_comparison/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | margin-top: 30px; 3 | margin-bottom: 70px; 4 | } -------------------------------------------------------------------------------- /databases/work_with_database/phones/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | djangorestframework==3.12.1 3 | psycopg2-binary==2.8.6 4 | -------------------------------------------------------------------------------- /first-project/first_project/app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /site-personalization/sessions/game/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /databases/work_with_database/phones/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /django-testing/django_testing/requirements-dev.txt: -------------------------------------------------------------------------------- 1 | -r requirements.txt 2 | pytest 3 | pytest-django 4 | model_bakery 5 | -------------------------------------------------------------------------------- /django-testing/django_testing/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | djangorestframework==3.12.1 3 | psycopg2-binary==2.8.6 4 | -------------------------------------------------------------------------------- /django-testing/django_testing/students/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/auth/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /site-personalization/paid_content/articles/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/auth/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/auth/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /django-testing/django_testing/tests/students/test_courses_api.py: -------------------------------------------------------------------------------- 1 | def test_example(): 2 | assert False, "Just test example" 3 | -------------------------------------------------------------------------------- /dynamic-templates/task1/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/dynamic-templates/task1/example.png -------------------------------------------------------------------------------- /dynamic-templates/task2/app/templatetags/app_tags.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | 3 | 4 | register = template.Library() 5 | 6 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/res/base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/res/base.png -------------------------------------------------------------------------------- /request-handling/landing/res/stats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/landing/res/stats.png -------------------------------------------------------------------------------- /request-handling/landing/res/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/landing/res/test.png -------------------------------------------------------------------------------- /site-form-works/car_admin/app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'app' 6 | -------------------------------------------------------------------------------- /site-form-works/review/app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'app' 6 | -------------------------------------------------------------------------------- /site-form-works/review/docs/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/review/docs/list.png -------------------------------------------------------------------------------- /databases_2/m2m-relations/res/admin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/res/admin.gif -------------------------------------------------------------------------------- /databases_2/m2m-relations/res/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/res/admin.png -------------------------------------------------------------------------------- /first-project/first_project/app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'app' 6 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'app' 6 | -------------------------------------------------------------------------------- /site-form-works/car_admin/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | static/admin/ 3 | static/ckeditor/ 4 | 5 | *.pyc 6 | 7 | settings_local.py 8 | db.sqlite3 9 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/app/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'app' 6 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/static/css/calc.css: -------------------------------------------------------------------------------- 1 | .left-margin { 2 | margin-left: 24px; 3 | } 4 | .width300 { 5 | width: 300px; 6 | } 7 | -------------------------------------------------------------------------------- /site-form-works/review/docs/product.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/review/docs/product.png -------------------------------------------------------------------------------- /databases/phone_comparison/phones/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'phones' 6 | -------------------------------------------------------------------------------- /databases/phone_comparison/res/catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases/phone_comparison/res/catalog.png -------------------------------------------------------------------------------- /databases/work_with_database/phones/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'phones' 6 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/res/with_tags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/res/with_tags.png -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /dynamic-templates/task2/app/static/ii.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/dynamic-templates/task2/app/static/ii.jpg -------------------------------------------------------------------------------- /dynamic-templates/task2/app/static/imac.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/dynamic-templates/task2/app/static/imac.jpg -------------------------------------------------------------------------------- /dynamic-templates/task2/app/static/mac.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/dynamic-templates/task2/app/static/mac.jpg -------------------------------------------------------------------------------- /request-handling/file_server/res/result.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/file_server/res/result.gif -------------------------------------------------------------------------------- /request-handling/landing/res/original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/landing/res/original.png -------------------------------------------------------------------------------- /request-handling/pagination/res/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/pagination/res/result.png -------------------------------------------------------------------------------- /site-form-works/credit_calc/docs/calc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/credit_calc/docs/calc.png -------------------------------------------------------------------------------- /site-personalization/sessions/game/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'game' 6 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'books' 6 | -------------------------------------------------------------------------------- /databases/work_with_database/res/catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases/work_with_database/res/catalog.png -------------------------------------------------------------------------------- /dynamic-templates/task2/app/static/steve.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/dynamic-templates/task2/app/static/steve.jpg -------------------------------------------------------------------------------- /site-form-works/car_admin/docs/admin_car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/car_admin/docs/admin_car.png -------------------------------------------------------------------------------- /site-personalization/paid_content/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | margin-top: 150px; 3 | } 4 | 5 | .articles { 6 | margin-top: 50px; 7 | } -------------------------------------------------------------------------------- /creating-project/project/moscow_bus_stations.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/creating-project/project/moscow_bus_stations.csv -------------------------------------------------------------------------------- /databases_2/m2m-relations/res/admin_error_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/res/admin_error_1.png -------------------------------------------------------------------------------- /databases_2/m2m-relations/res/admin_error_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/res/admin_error_2.png -------------------------------------------------------------------------------- /django-testing/django_testing/students/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class StudentsConfig(AppConfig): 5 | name = 'students' 6 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/docs/datepicker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/avia_scanner/docs/datepicker.png -------------------------------------------------------------------------------- /site-form-works/car_admin/docs/admin_review.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/car_admin/docs/admin_review.png -------------------------------------------------------------------------------- /site-form-works/car_admin/docs/ckeditor_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/car_admin/docs/ckeditor_full.png -------------------------------------------------------------------------------- /site-form-works/review/static/css/review.css: -------------------------------------------------------------------------------- 1 | .preview { 2 | width: 150px; 3 | height: auto; 4 | } 5 | .margin-left { 6 | margin-left: 100px; 7 | } -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/auth/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'auth' 6 | -------------------------------------------------------------------------------- /site-personalization/paid_content/articles/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | name = 'articles' 6 | -------------------------------------------------------------------------------- /site-personalization/sessions/res/screen_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/sessions/res/screen_1.png -------------------------------------------------------------------------------- /site-personalization/sessions/res/screen_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/sessions/res/screen_2.png -------------------------------------------------------------------------------- /site-personalization/sessions/res/screen_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/sessions/res/screen_3.png -------------------------------------------------------------------------------- /site-personalization/sessions/res/screen_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/sessions/res/screen_4.png -------------------------------------------------------------------------------- /databases/models_list_displaying/res/catalog_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases/models_list_displaying/res/catalog_1.png -------------------------------------------------------------------------------- /databases/models_list_displaying/res/catalog_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases/models_list_displaying/res/catalog_2.png -------------------------------------------------------------------------------- /drf-intro/simple_crud/measurements/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MeasurementsConfig(AppConfig): 5 | name = 'measurements' 6 | -------------------------------------------------------------------------------- /site-form-works/review/images/2018/09/29/gkehh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/review/images/2018/09/29/gkehh.jpg -------------------------------------------------------------------------------- /site-personalization/paid_content/res/articles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/paid_content/res/articles.png -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/requirements.txt: -------------------------------------------------------------------------------- 1 | Django==3.1.2 2 | djangorestframework==3.12.1 3 | psycopg2-binary==2.8.6 4 | django-filter==2.4.0 5 | -------------------------------------------------------------------------------- /request-handling/landing/static/img/background1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/landing/static/img/background1.jpg -------------------------------------------------------------------------------- /request-handling/landing/static/img/background2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/landing/static/img/background2.jpg -------------------------------------------------------------------------------- /request-handling/pagination/data-398-2018-08-30.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/pagination/data-398-2018-08-30.csv -------------------------------------------------------------------------------- /site-form-works/avia_scanner/docs/citypicker_ajax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/avia_scanner/docs/citypicker_ajax.png -------------------------------------------------------------------------------- /site-form-works/review/products/2018/09/29/gkehh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/review/products/2018/09/29/gkehh.jpg -------------------------------------------------------------------------------- /databases/work_with_database/phones/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Phone(models.Model): 5 | # TODO: Добавьте требуемые поля 6 | pass 7 | -------------------------------------------------------------------------------- /site-personalization/paid_content/res/free_article.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/paid_content/res/free_article.png -------------------------------------------------------------------------------- /site-personalization/paid_content/res/paid_article.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/paid_content/res/paid_article.png -------------------------------------------------------------------------------- /site-personalization/sessions/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | margin-top: 30px; 3 | margin-bottom: 150px; 4 | } 5 | 6 | .message { 7 | margin-top: 10px; 8 | } -------------------------------------------------------------------------------- /databases_2/m2m-relations/media/th_1488217075_CVC0Ltk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/media/th_1488217075_CVC0Ltk.jpg -------------------------------------------------------------------------------- /databases_2/m2m-relations/media/th_1521804489_cfyJCMV.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/media/th_1521804489_cfyJCMV.jpg -------------------------------------------------------------------------------- /databases_2/m2m-relations/media/th_946876594_EntghVT.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/m2m-relations/media/th_946876594_EntghVT.jpg -------------------------------------------------------------------------------- /databases_2/orm_migrations/media/th_1488217075_CVC0Ltk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/orm_migrations/media/th_1488217075_CVC0Ltk.jpg -------------------------------------------------------------------------------- /databases_2/orm_migrations/media/th_1521804489_cfyJCMV.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/orm_migrations/media/th_1521804489_cfyJCMV.jpg -------------------------------------------------------------------------------- /databases_2/orm_migrations/media/th_946876594_EntghVT.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/databases_2/orm_migrations/media/th_946876594_EntghVT.jpg -------------------------------------------------------------------------------- /site-form-works/avia_scanner/docs/citypicker_standart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/avia_scanner/docs/citypicker_standart.png -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/res/screen_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/auth_and_reg_users/res/screen_1.png -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/res/screen_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/auth_and_reg_users/res/screen_2.png -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/res/screen_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/auth_and_reg_users/res/screen_3.png -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/res/screen_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/auth_and_reg_users/res/screen_4.png -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/res/screen_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-personalization/auth_and_reg_users/res/screen_5.png -------------------------------------------------------------------------------- /databases_2/orm_migrations/school/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class SchoolConfig(AppConfig): 5 | name = 'school' 6 | verbose_name = 'Школа' 7 | -------------------------------------------------------------------------------- /databases_2/orm_query/articles/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ArticlesConfig(AppConfig): 5 | name = 'articles' 6 | verbose_name = 'Новости' 7 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ArticlesConfig(AppConfig): 5 | name = 'articles' 6 | verbose_name = 'Новости' 7 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AdvertisementsConfig(AppConfig): 5 | name = 'advertisements' 6 | -------------------------------------------------------------------------------- /request-handling/landing/static/img/animal-blur-close-up-840326.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/request-handling/landing/static/img/animal-blur-close-up-840326.jpg -------------------------------------------------------------------------------- /creating-project/application/phones.csv: -------------------------------------------------------------------------------- 1 | id;name;price;release_date;lte_exists 2 | 1;Samsung Galaxy Edge 2;73000;2016-12-12;True; 3 | 2;Iphone X;80000;2017-06-01;True; 4 | 3;Nokia 8;20000;2013-01-20;False; -------------------------------------------------------------------------------- /databases_2/orm_migrations/school/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from school.views import students_list 4 | 5 | urlpatterns = [ 6 | path('', students_list, name='students'), 7 | ] 8 | -------------------------------------------------------------------------------- /databases_2/orm_query/articles/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from articles.views import articles_list 4 | 5 | urlpatterns = [ 6 | path('', articles_list, name='articles'), 7 | ] 8 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/screenshots/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/drf-auth-and-validation/api_with_restrictions/screenshots/success.png -------------------------------------------------------------------------------- /site-personalization/sessions/game/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def show_home(request): 5 | return render( 6 | request, 7 | 'home.html' 8 | ) 9 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from articles.views import articles_list 4 | 5 | urlpatterns = [ 6 | path('', articles_list, name='articles'), 7 | ] 8 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/screenshots/bad_token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/drf-auth-and-validation/api_with_restrictions/screenshots/bad_token.png -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/screenshots/date_filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/drf-auth-and-validation/api_with_restrictions/screenshots/date_filter.png -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Article 4 | 5 | 6 | @admin.register(Article) 7 | class ArticleAdmin(admin.ModelAdmin): 8 | pass 9 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/screenshots/validation_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/drf-auth-and-validation/api_with_restrictions/screenshots/validation_error.png -------------------------------------------------------------------------------- /site-form-works/review/images/2018/09/29/46511d3ce6fdeb66a99216c6ae5dd415.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/netology-code/dj-homeworks/HEAD/site-form-works/review/images/2018/09/29/46511d3ce6fdeb66a99216c6ae5dd415.jpg -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class City(models.Model): 5 | name = models.CharField(max_length=50) 6 | 7 | def __str__(self): 8 | return f'{self.name}' 9 | -------------------------------------------------------------------------------- /request-handling/landing/static/js/init.js: -------------------------------------------------------------------------------- 1 | (function($){ 2 | $(function(){ 3 | 4 | $('.sidenav').sidenav(); 5 | $('.parallax').parallax(); 6 | 7 | }); // end of document ready 8 | })(jQuery); // end of jQuery name space -------------------------------------------------------------------------------- /databases/models_list_displaying/books/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def books_view(request): 5 | template = 'books/books_list.html' 6 | context = {} 7 | return render(request, template, context) 8 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import City 4 | 5 | 6 | class CityAdmin(admin.ModelAdmin): 7 | list_display = ('name', ) 8 | 9 | admin.site.register(City, CityAdmin) 10 | -------------------------------------------------------------------------------- /site-personalization/paid_content/articles/models.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import User 2 | from django.db import models 3 | 4 | 5 | class Profile(models.Model): 6 | pass 7 | 8 | 9 | class Article(models.Model): 10 | pass 11 | -------------------------------------------------------------------------------- /site-personalization/sessions/game/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Player(models.Model): 5 | pass 6 | 7 | 8 | class Game(models.Model): 9 | pass 10 | 11 | 12 | class PlayerGameInfo(models.Model): 13 | pass 14 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | 3 | from .widgets import AjaxInputWidget 4 | from .models import City 5 | 6 | 7 | class SearchTicket(forms.Form): 8 | # Добавьте здесь поля, описанные в задании 9 | pass 10 | -------------------------------------------------------------------------------- /request-handling/pagination/app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from app.views import index, bus_stations 4 | 5 | 6 | urlpatterns = [ 7 | path('', index, name='index'), 8 | path('bus_stations', bus_stations, name='bus_stations'), 9 | ] 10 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/converters.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | class PubDateConverter: 4 | regex = '[0-9]{4}-[0-9]{2}-[0-9]{2}' 5 | 6 | def to_python(self, value): 7 | return value 8 | 9 | def to_url(self, value): 10 | return value.__str__() -------------------------------------------------------------------------------- /databases/phone_comparison/phones/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def show_catalog(request): 5 | template = 'catalog.html' 6 | context = {} 7 | return render( 8 | request, 9 | template, 10 | context 11 | ) 12 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from books.models import Book 4 | 5 | 6 | class BookAdmin(admin.ModelAdmin): 7 | list_display = ('name', 'author', 'pub_date',) 8 | 9 | 10 | admin.site.register(Book, BookAdmin) 11 | -------------------------------------------------------------------------------- /databases/models_list_displaying/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | margin-top: 30px; 3 | margin-bottom: 150px; 4 | } 5 | 6 | .footer { 7 | margin-top: 150px; 8 | font-size: 24px; 9 | } 10 | 11 | .book { 12 | margin-top: 30px; 13 | margin-bottom: 30px; 14 | } -------------------------------------------------------------------------------- /request-handling/landing/app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | from app.views import landing, stats, index 4 | 5 | 6 | urlpatterns = [ 7 | path('', index, name='index'), 8 | path('landing/', landing, name='landing'), 9 | path('stats/', stats, name='stats'), 10 | ] 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE specific 2 | .idea/ 3 | .vscode/ 4 | 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | *.py[cod] 8 | *$py.class 9 | 10 | *.sqlite3 11 | env/ 12 | venv/ 13 | .venv/ 14 | 15 | ### Project specific ### 16 | settings_local.py 17 | 18 | ### OS specific ### 19 | .DS_Store -------------------------------------------------------------------------------- /django-testing/django_testing/students/serializers.py: -------------------------------------------------------------------------------- 1 | from rest_framework import serializers 2 | 3 | from students.models import Course 4 | 5 | 6 | class CourseSerializer(serializers.ModelSerializer): 7 | 8 | class Meta: 9 | model = Course 10 | fields = ("id", "name", "students") 11 | -------------------------------------------------------------------------------- /dynamic-templates/task1/app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | def inflation_view(request): 4 | template_name = 'inflation.html' 5 | 6 | # чтение csv-файла и заполнение контекста 7 | context = {} 8 | 9 | return render(request, template_name, 10 | context) -------------------------------------------------------------------------------- /site-form-works/car_admin/car_admin/settings_local_sample.py: -------------------------------------------------------------------------------- 1 | # SECURITY WARNING: keep the secret key used in production secret! 2 | SECRET_KEY = 'b0e@^m&tccz11$w59qov$lhn-97!(%wfn-gray-c*x)^a$wx=2' 3 | 4 | # SECURITY WARNING: don't run with debug turned on in production! 5 | DEBUG = True 6 | 7 | ALLOWED_HOSTS = [] 8 | -------------------------------------------------------------------------------- /site-form-works/review/product_review/settings_local_sample.py: -------------------------------------------------------------------------------- 1 | # SECURITY WARNING: keep the secret key used in production secret! 2 | SECRET_KEY = 'b0e@^m&tccz11$w59qov$lhn-97!(%wfn-gray-c*x)^a$wx=2' 3 | 4 | # SECURITY WARNING: don't run with debug turned on in production! 5 | DEBUG = True 6 | 7 | ALLOWED_HOSTS = [] 8 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/school/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Student, Teacher 4 | 5 | 6 | @admin.register(Student) 7 | class StudentAdmin(admin.ModelAdmin): 8 | pass 9 | 10 | 11 | @admin.register(Teacher) 12 | class TeacherAdmin(admin.ModelAdmin): 13 | pass 14 | -------------------------------------------------------------------------------- /request-handling/landing/app/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | 3 | {% load static %} 4 | 5 | {% block content %} 6 | 7 | 8 |
9 |
10 | 11 |

Спасибо, что посетили наш сайт!

12 | 13 |
14 |
15 | {% endblock %} -------------------------------------------------------------------------------- /site-form-works/avia_scanner/avia_scanner/settings_local_sample.py: -------------------------------------------------------------------------------- 1 | # SECURITY WARNING: keep the secret key used in production secret! 2 | SECRET_KEY = 'b0e@^m&tccz11$w59qov$lhn-97!(%wfn-gray-c*x)^a$wx=2' 3 | 4 | # SECURITY WARNING: don't run with debug turned on in production! 5 | DEBUG = True 6 | 7 | ALLOWED_HOSTS = [] 8 | -------------------------------------------------------------------------------- /site-form-works/review/app/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Review 3 | 4 | 5 | class ReviewForm(forms.ModelForm): 6 | text = forms.CharField(widget=forms.Textarea, label='Отзыв') 7 | 8 | class Meta(object): 9 | model = Review 10 | exclude = ('id', 'product') 11 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/auth/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def home(request): 5 | return render( 6 | request, 7 | 'home.html' 8 | ) 9 | 10 | 11 | def signup(request): 12 | return render( 13 | request, 14 | 'signup.html' 15 | ) 16 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/templates/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Регистрация{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |

Регистрация

10 |
11 | {% endblock %} -------------------------------------------------------------------------------- /databases/phone_comparison/templates/catalog.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Каталог{% endblock %} 5 | {% block content %} 6 |
7 |
8 |

Сравнение телефонов

9 |
10 |
11 | {% endblock %} -------------------------------------------------------------------------------- /databases/work_with_database/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | margin-top: 30px; 3 | margin-bottom: 50px; 4 | } 5 | 6 | .phone { 7 | margin-top: 30px; 8 | margin-bottom: 30px; 9 | } 10 | 11 | .sort-block .sort-item { 12 | padding-right: 20px; 13 | } 14 | 15 | .price { 16 | font-weight: bold; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | from .forms import CalcForm 4 | 5 | 6 | def calc_view(request): 7 | template = "app/calc.html" 8 | 9 | form = CalcForm 10 | context = { 11 | 'form': form 12 | } 13 | 14 | return render(request, template, context) 15 | -------------------------------------------------------------------------------- /creating-project/application/app/templatetags/app_tags.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from django import template 3 | 4 | register = template.Library() 5 | 6 | 7 | @register.filter 8 | def get_item(value, arg=''): 9 | result = '' 10 | if isinstance(value, dict): 11 | result = value.get(arg, '') 12 | return result 13 | -------------------------------------------------------------------------------- /site-personalization/sessions/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Угадай число{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |

Игра "Угадай число"

10 |
11 |
12 | {% endblock %} -------------------------------------------------------------------------------- /site-personalization/paid_content/articles/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def show_articles(request): 5 | return render( 6 | request, 7 | 'articles.html' 8 | ) 9 | 10 | 11 | def show_article(request, id): 12 | return render( 13 | request, 14 | 'article.html' 15 | ) 16 | -------------------------------------------------------------------------------- /site-personalization/paid_content/templates/article.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Заголовок статьи{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |

Заголовок статьи

10 |
11 |
12 | {% endblock %} -------------------------------------------------------------------------------- /site-form-works/car_admin/app/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | from .models import Review 3 | 4 | from ckeditor.widgets import CKEditorWidget 5 | 6 | 7 | class ReviewAdminForm(forms.ModelForm): 8 | text = forms.CharField(widget=CKEditorWidget()) 9 | 10 | class Meta: 11 | model = Review 12 | fields = ['car', 'title', 'text'] 13 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/measurements/views.py: -------------------------------------------------------------------------------- 1 | from rest_framework.viewsets import ModelViewSet 2 | 3 | 4 | class ProjectViewSet(ModelViewSet): 5 | """ViewSet для проекта.""" 6 | # TODO: добавьте конфигурацию для объекта 7 | 8 | 9 | class MeasurementViewSet(ModelViewSet): 10 | """ViewSet для измерения.""" 11 | # TODO: добавьте конфигурацию для измерения 12 | -------------------------------------------------------------------------------- /databases/work_with_database/templates/product.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Телефон{% endblock %} 5 | {% block content %} 6 |
7 |
8 |

Телефон

9 |
10 |
11 | 12 |
13 |
14 | {% endblock %} -------------------------------------------------------------------------------- /databases/work_with_database/phones/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def show_catalog(request): 5 | template = 'catalog.html' 6 | context = {} 7 | return render(request, template, context) 8 | 9 | 10 | def show_product(request, slug): 11 | template = 'product.html' 12 | context = {} 13 | return render(request, template, context) 14 | -------------------------------------------------------------------------------- /first-project/first_project/app/templates/app/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Домашняя страница 6 | 7 | 8 |

Выберите раздел

9 | {% for title, url in pages.items %} 10 | {{ title }} 11 |
12 | {% endfor %} 13 | 14 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/templates/widget/ajax_input_widget.html: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/filters.py: -------------------------------------------------------------------------------- 1 | from django_filters import rest_framework as filters 2 | 3 | from advertisements.models import Advertisement 4 | 5 | 6 | class AdvertisementFilter(filters.FilterSet): 7 | """Фильтры для объявлений.""" 8 | 9 | # TODO: задайте требуемые фильтры 10 | 11 | class Meta: 12 | model = Advertisement 13 | -------------------------------------------------------------------------------- /drf-intro/README.md: -------------------------------------------------------------------------------- 1 | # Знакомство с API на примере Django REST framework 2 | 3 | Необходимо выполнить и предоставить на проверку задачу: 4 | 5 | [API CRUD для сущностей](./simple_crud/) 6 | 7 | Работа должна соответствовать 8 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 9 | 10 | Любые вопросы по решению задач задавайте в Slack-чате. 11 | -------------------------------------------------------------------------------- /site-form-works/car_admin/app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Car, Review 4 | from .forms import ReviewAdminForm 5 | 6 | 7 | class CarAdmin(admin.ModelAdmin): 8 | pass 9 | 10 | 11 | class ReviewAdmin(admin.ModelAdmin): 12 | form = ReviewAdminForm 13 | 14 | 15 | admin.site.register(Car, CarAdmin) 16 | admin.site.register(Review, ReviewAdmin) 17 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/models.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | 3 | from django.db import models 4 | 5 | 6 | class Book(models.Model): 7 | name = models.CharField(u'Название', max_length=64) 8 | author = models.CharField(u'Автор', max_length=64) 9 | pub_date = models.DateField(u'Дата публикации') 10 | 11 | def __str__(self): 12 | return self.name + " " + self.author 13 | -------------------------------------------------------------------------------- /site-form-works/review/app/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Product, Review 4 | 5 | 6 | class ProductAdmin(admin.ModelAdmin): 7 | list_display = ('id', 'name') 8 | 9 | 10 | class ReviewAdmin(admin.ModelAdmin): 11 | list_display = ('id', 'text') 12 | 13 | 14 | admin.site.register(Product, ProductAdmin) 15 | admin.site.register(Review, ReviewAdmin) 16 | -------------------------------------------------------------------------------- /databases_2/orm_query/articles/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | from .models import Article, Genre, Author 4 | 5 | 6 | @admin.register(Article) 7 | class ArticleAdmin(admin.ModelAdmin): 8 | pass 9 | 10 | 11 | @admin.register(Genre) 12 | class GenreAdmin(admin.ModelAdmin): 13 | pass 14 | 15 | 16 | @admin.register(Author) 17 | class AuthorAdmin(admin.ModelAdmin): 18 | pass 19 | -------------------------------------------------------------------------------- /dynamic-templates/task3/app/templatetags/news_filters.py: -------------------------------------------------------------------------------- 1 | from django import template 2 | 3 | 4 | register = template.Library() 5 | 6 | 7 | @register.filter 8 | def format_date(value): 9 | # Ваш код 10 | return value 11 | 12 | 13 | # необходимо добавить фильтр для поля `score` 14 | 15 | 16 | @register.filter 17 | def format_num_comments(value): 18 | # Ваш код 19 | return value 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | margin-top: 50px; 3 | } 4 | 5 | .auth-btn { 6 | margin-top: 5px; 7 | } 8 | 9 | #id_username, #id_password, #id_password1, #id_password2 { 10 | border: 1px solid grey; 11 | border-radius: 3px; 12 | padding: 10px; 13 | margin-top: 5px; 14 | margin-bottom: 5px; 15 | } 16 | 17 | .form-auth { 18 | margin-top: 30px; 19 | } -------------------------------------------------------------------------------- /django-testing/django_testing/students/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Student(models.Model): 5 | 6 | name = models.TextField() 7 | 8 | birth_date = models.DateField( 9 | null=True, 10 | ) 11 | 12 | 13 | class Course(models.Model): 14 | 15 | name = models.TextField() 16 | 17 | students = models.ManyToManyField( 18 | Student, 19 | blank=True, 20 | ) 21 | -------------------------------------------------------------------------------- /databases/work_with_database/phones.csv: -------------------------------------------------------------------------------- 1 | id;name;image;price;release_date;lte_exists 2 | 1;Samsung Galaxy Edge 2;https://avatars.mds.yandex.net/get-mpic/364668/img_id5636027222104023144.jpeg/orig;73000;2016-12-12;True; 3 | 2;Iphone X;https://avatars.mds.yandex.net/get-mpic/200316/img_id270362589725797013.png/orig;80000;2017-06-01;True; 4 | 3;Nokia 8;https://avatars.mds.yandex.net/get-mpic/397397/img_id6752445806321208103.jpeg/orig;20000;2013-01-20;False; -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Главная страница{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 | Привет, гость.
10 | Пожалуйста, зарегистрируйся или авторизуйся! 11 |
12 | {% endblock %} -------------------------------------------------------------------------------- /django-testing/README.md: -------------------------------------------------------------------------------- 1 | # Тестирование Django-приложения с использованием Pytest 2 | 3 | Необходимо выполнить и предоставить на проверку задачу: 4 | 5 | [Тестирование Django-приложения с использованием Pytest](./django_testing/) 6 | 7 | Работа должна соответствовать 8 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 9 | 10 | Любые вопросы по решению задач задавайте в Slack-чате. 11 | -------------------------------------------------------------------------------- /drf-auth-and-validation/README.md: -------------------------------------------------------------------------------- 1 | # Django REST framework: фильтрация, валидация и аутентификация 2 | 3 | Необходимо выполнить и предоставить на проверку задачу: 4 | 5 | [Backend для приложения с объявлениями](./api_with_restrictions/) 6 | 7 | Работа должна соответствовать 8 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 9 | 10 | Любые вопросы по решению задач задавайте в Slack-чате. 11 | -------------------------------------------------------------------------------- /databases/models_list_displaying/fixtures/books.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "books.book", 4 | "pk": 1, 5 | "fields": { 6 | "name": "Война и мир", 7 | "author": "Ф.Д. Достоевский", 8 | "pub_date": "2018-02-27" 9 | } 10 | }, 11 | { 12 | "model": "books.book", 13 | "pk": 2, 14 | "fields": { 15 | "name": "1984", 16 | "author": "Джордж Оруэл", 17 | "pub_date": "2016-12-06" 18 | } 19 | } 20 | ] -------------------------------------------------------------------------------- /django-testing/django_testing/students/filters.py: -------------------------------------------------------------------------------- 1 | from django_filters import rest_framework as filters 2 | 3 | from students.models import Course 4 | 5 | 6 | class CourseFilter(filters.FilterSet): 7 | 8 | id = filters.ModelMultipleChoiceFilter( 9 | field_name="id", 10 | to_field_name="id", 11 | queryset=Course.objects.all(), 12 | ) 13 | 14 | class Meta: 15 | model = Course 16 | fields = ("id", "name", ) 17 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/templates/school/students_list.html: -------------------------------------------------------------------------------- 1 | {% extends "school/base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Список учеников{% endblock %} 5 | {% block content %} 6 |
7 | 12 |
13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /creating-project/project/static/css/style.css: -------------------------------------------------------------------------------- 1 | .header { 2 | font-weight: bold; 3 | } 4 | 5 | html, body { 6 | width: 100%; 7 | height: 100%; 8 | padding: 0; 9 | margin: 0; 10 | } 11 | 12 | #map { 13 | width: 100%; 14 | height: calc(100% - 50px); 15 | padding: 0; 16 | margin: 0; 17 | } 18 | 19 | #label { 20 | text-align: right; 21 | padding: 3px; 22 | } 23 | 24 | .form-top { 25 | padding: 3px; 26 | margin: auto; 27 | } -------------------------------------------------------------------------------- /dynamic-templates/task1/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for app project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /dynamic-templates/task2/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for app project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /request-handling/landing/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for app project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /request-handling/pagination/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for app project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /creating-project/application/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for app project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /databases/phone_comparison/main/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for main project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /databases/work_with_database/main/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for main project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /dynamic-templates/task3/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for filters project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'filters.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-personalization/sessions/main/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for main project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /databases/models_list_displaying/main/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for main project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/website/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for website project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /databases_2/orm_query/website/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for website project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /request-handling/file_server/app/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for file_server project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-personalization/paid_content/main/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for main project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-personalization/paid_content/templates/articles.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Журнал{% endblock %} 5 | 6 | {% block content %} 7 |
8 |
9 |

Список статей

10 |
11 |
12 |

Статья 1

13 |

Статья 2

14 |

Статья 3

15 |
16 |
17 | {% endblock %} -------------------------------------------------------------------------------- /databases_2/orm_migrations/website/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for website project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/main/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for main project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/simple_crud/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for simple_crud project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simple_crud.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/simple_crud/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for simple_crud project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simple_crud.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-form-works/car_admin/car_admin/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for car_admin project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'car_admin.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-form-works/car_admin/templates/app/calc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Калькулятор 4 | 5 | 6 |
7 | {% for field in form %} 8 |

{{ field.label_tag }}

{{ field }} 9 | {{ field.errors }} 10 | {% endfor %} 11 | 12 |
13 | {% if result %} 14 |

Результат:

15 |

{{result}}

16 | {% endif %} 17 | 18 | -------------------------------------------------------------------------------- /first-project/README.md: -------------------------------------------------------------------------------- 1 | Знакомство с Django 2 | === 3 | 4 | Перед выполнением обязательно ознакомьтесь с информацией о том, [как работать с репозиторием домашних работ](/HOW_TO_WORK.md). 5 | 6 | Необходимо выполнить и предоставить на проверку задачу: 7 | 8 | 1. [Создание проекта](./first_project/) 9 | 10 | Работа должна соответствовать 11 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 12 | 13 | Любые вопросы по решению задач задавайте в Slack-чате. 14 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/credit_calc/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for credit_calc project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'credit_calc.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /first-project/first_project/first_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for first_project project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'first_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/avia_scanner/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for avia_scanner project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'avia_scanner.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-form-works/review/product_review/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for product_review project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'product_review.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /django-testing/django_testing/django_testing/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for django_testing project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_testing.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /django-testing/django_testing/django_testing/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for django_testing project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_testing.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-form-works/review/templates/app/product_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Товары

5 |
6 | {% for product in product_list %} 7 |
8 | 9 | {{ product.name }} 10 | 11 |
12 | {% endfor %} 13 |
14 | {% endblock %} 15 | -------------------------------------------------------------------------------- /databases_2/orm_query/static/css/3-col-portfolio.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - 3 Col Portfolio (https://startbootstrap.com/template-overviews/3-col-portfolio) 3 | * Copyright 2013-2018 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-3-col-portfolio/blob/master/LICENSE) 5 | */ 6 | 7 | body { 8 | padding-top: 84px; 9 | padding-bottom: 84px; 10 | } 11 | 12 | @media (min-width: 992px) { 13 | body { 14 | padding-top: 86px; 15 | padding-bottom: 86px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /site-form-works/review/app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Product(models.Model): 5 | name = models.CharField(max_length=50) 6 | img = models.FileField(upload_to='products/%Y/%m/%d/') 7 | 8 | def __str__(self): 9 | return self.name 10 | 11 | 12 | class Review(models.Model): 13 | text = models.TextField() 14 | product = models.ForeignKey(Product, on_delete=models.CASCADE) 15 | 16 | def __str__(self): 17 | return str(self.product.name) + ' ' + self.text[:50] 18 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/static/css/3-col-portfolio.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - 3 Col Portfolio (https://startbootstrap.com/template-overviews/3-col-portfolio) 3 | * Copyright 2013-2018 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-3-col-portfolio/blob/master/LICENSE) 5 | */ 6 | 7 | body { 8 | padding-top: 84px; 9 | padding-bottom: 84px; 10 | } 11 | 12 | @media (min-width: 992px) { 13 | body { 14 | padding-top: 86px; 15 | padding-bottom: 86px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/static/css/3-col-portfolio.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - 3 Col Portfolio (https://startbootstrap.com/template-overviews/3-col-portfolio) 3 | * Copyright 2013-2018 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-3-col-portfolio/blob/master/LICENSE) 5 | */ 6 | 7 | body { 8 | padding-top: 84px; 9 | padding-bottom: 84px; 10 | } 11 | 12 | @media (min-width: 992px) { 13 | body { 14 | padding-top: 86px; 15 | padding-bottom: 86px; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /django-testing/django_testing/students/views.py: -------------------------------------------------------------------------------- 1 | from django_filters.rest_framework import DjangoFilterBackend 2 | from rest_framework.viewsets import ModelViewSet 3 | 4 | from students.filters import CourseFilter 5 | from students.models import Course 6 | from students.serializers import CourseSerializer 7 | 8 | 9 | class CoursesViewSet(ModelViewSet): 10 | 11 | queryset = Course.objects.all() 12 | serializer_class = CourseSerializer 13 | filter_backends = (DjangoFilterBackend, ) 14 | filterset_class = CourseFilter 15 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/school/views.py: -------------------------------------------------------------------------------- 1 | from django.views.generic import ListView 2 | from django.shortcuts import render 3 | 4 | from .models import Student 5 | 6 | 7 | def students_list(request): 8 | template = 'school/students_list.html' 9 | context = {} 10 | 11 | # используйте этот параметр для упорядочивания результатов 12 | # https://docs.djangoproject.com/en/2.2/ref/models/querysets/#django.db.models.query.QuerySet.order_by 13 | ordering = 'group' 14 | 15 | return render(request, template, context) 16 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/views.py: -------------------------------------------------------------------------------- 1 | from django.views.generic import ListView 2 | from django.shortcuts import render 3 | 4 | from articles.models import Article 5 | 6 | 7 | def articles_list(request): 8 | template = 'articles/news.html' 9 | context = {} 10 | 11 | # используйте этот параметр для упорядочивания результатов 12 | # https://docs.djangoproject.com/en/2.2/ref/models/querysets/#django.db.models.query.QuerySet.order_by 13 | ordering = '-published_at' 14 | 15 | return render(request, template, context) 16 | -------------------------------------------------------------------------------- /databases_2/orm_query/articles/views.py: -------------------------------------------------------------------------------- 1 | from django.views.generic import ListView 2 | from django.shortcuts import render 3 | 4 | from .models import Article 5 | 6 | 7 | def articles_list(request): 8 | template_name = 'articles/news.html' 9 | context = {} 10 | 11 | # используйте этот параметр для упорядочивания результатов 12 | # https://docs.djangoproject.com/en/2.2/ref/models/querysets/#django.db.models.query.QuerySet.order_by 13 | ordering = '-published_at' 14 | 15 | return render(request, template_name, context) 16 | -------------------------------------------------------------------------------- /django-testing/django_testing/students/migrations/0002_auto_20201101_2359.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.2 on 2020-11-01 23:59 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('students', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='course', 15 | name='students', 16 | field=models.ManyToManyField(blank=True, to='students.Student'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /request-handling/file_server/files/server.03: -------------------------------------------------------------------------------- 1 | > wmic CPU get Name,NumberOfCores,NumberOfLogicalProcessors 2 | Name NumberOfCores NumberOfLogicalProcessors 3 | Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz 2 4 | 2 5 | > wmic MEMPHYSICAL get MaxCapacity 6 | MaxCapacity 7 | 301989888 8 | 9 | > wmic OS get Caption,CSDVersion,OSArchitecture,Version 10 | Caption CSDVersion OSArchitecture Version 11 | Microsoft® Windows Server® 2008 Datacenter Service Pack 2 64-bit 6.0.6002 -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/api_with_restrictions/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for api_with_restrictions project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api_with_restrictions.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/api_with_restrictions/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for api_with_restrictions project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api_with_restrictions.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /site-form-works/car_admin/app/migrations/0002_review_title.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1.1 on 2018-09-28 13:27 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('app', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='review', 15 | name='title', 16 | field=models.CharField(default='No title', max_length=100), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Article(models.Model): 5 | 6 | title = models.CharField(max_length=256, verbose_name='Название') 7 | text = models.TextField(verbose_name='Текст') 8 | published_at = models.DateTimeField(verbose_name='Дата публикации') 9 | image = models.ImageField(null=True, blank=True, verbose_name='Изображение',) 10 | 11 | class Meta: 12 | verbose_name = 'Статья' 13 | verbose_name_plural = 'Статьи' 14 | 15 | def __str__(self): 16 | return self.title 17 | -------------------------------------------------------------------------------- /request-handling/file_server/app/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | # Определите и зарегистрируйте конвертер для определения даты в урлах и наоборот урла по датам 4 | 5 | 6 | urlpatterns = [ 7 | # Определите схему урлов с привязкой к отображениям .views.file_list и .views.file_content 8 | # path(..., name='file_list'), 9 | # path(..., name='file_list'), # задайте необязательный параметр "date" 10 | # для детальной информации смотрите HTML-шаблоны в директории templates 11 | # path(..., name='file_content'), 12 | ] 13 | -------------------------------------------------------------------------------- /databases/work_with_database/templates/catalog.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Каталог{% endblock %} 5 | {% block content %} 6 |
7 |
8 |

Каталог

9 |
10 | 11 |
12 | {# Здесь должен быть раздел с сортировкой #} 13 |
14 | 15 |
16 | {# Здесь должен отображаться каталог с телефонами #} 17 |
18 |
19 | {% endblock %} -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/views.py: -------------------------------------------------------------------------------- 1 | from rest_framework.permissions import IsAuthenticated 2 | from rest_framework.viewsets import ModelViewSet 3 | 4 | 5 | class AdvertisementViewSet(ModelViewSet): 6 | """ViewSet для объявлений.""" 7 | 8 | # TODO: настройте ViewSet, укажите атрибуты для кверисета, 9 | # сериализаторов и фильтров 10 | 11 | def get_permissions(self): 12 | """Получение прав для действий.""" 13 | if self.action in ["create", "update", "partial_update"]: 14 | return [IsAuthenticated()] 15 | return [] 16 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/widgets.py: -------------------------------------------------------------------------------- 1 | from django.forms.widgets import TextInput 2 | 3 | 4 | class AjaxInputWidget(TextInput): 5 | template_name = 'widget/ajax_input_widget.html' 6 | url = '' 7 | 8 | def __init__(self, url, attrs=None): 9 | """url: путь к ajax API которое будет возвращать список городов для подстановки""" 10 | super().__init__(attrs) 11 | self.url = url 12 | 13 | def get_context(self, name, value, attrs): 14 | context = super().get_context(name, value, attrs) 15 | context['widget']['url'] = self.url 16 | return context 17 | -------------------------------------------------------------------------------- /request-handling/file_server/app/templates/file_content.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 |
7 |
8 | {{ file_name }} 9 | 10 |
11 | 14 |
15 |
16 |
17 | {% endblock %} -------------------------------------------------------------------------------- /databases/phone_comparison/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /databases_2/README.md: -------------------------------------------------------------------------------- 1 | Работа с ORM, часть 2 2 | === 3 | 4 | Необходимо выполнить и предоставить на проверку следующие задачи: 5 | 6 | 1. [Связь многие-ко-многим](./m2m-relations/) 7 | 2. [Миграции](./orm_migrations) 8 | 9 | Дополнительные задания: 10 | 11 | 1. [Работа с базой](./orm_query/) 12 | 13 | 14 | Присылать на проверку нужно сразу все обязательные задачи. Дополнительные задачи не влияют на получение зачета. 15 | 16 | Работы должны соответствовать 17 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 18 | 19 | Любые вопросы по решению задач задавайте в чате Slack. 20 | -------------------------------------------------------------------------------- /databases_2/orm_query/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /dynamic-templates/task1/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /dynamic-templates/task2/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /dynamic-templates/task3/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /request-handling/landing/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /request-handling/pagination/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1.1 on 2018-09-27 13:24 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='City', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=50)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /creating-project/application/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /databases/work_with_database/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /request-handling/file_server/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == "__main__": 6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-form-works/car_admin/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'car_admin.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-personalization/sessions/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /databases/models_list_displaying/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'avia_scanner.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'credit_calc.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-form-works/review/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'product_review.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-personalization/paid_content/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'main.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /dynamic-templates/task3/app/views.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from django.shortcuts import render 3 | 4 | 5 | def do_request(): 6 | resp = requests.get('https://reddit.com/r/Python/top.json', 7 | headers={'User-Agent': 'Python Netology'}) 8 | return resp.json()['data']['children'] 9 | 10 | 11 | def convert_post(post): 12 | yield post 13 | 14 | 15 | def top_reddit_view(request): 16 | template_name = 'top_reddit.html' 17 | 18 | posts = do_request() 19 | context = { 20 | 'posts': posts, 21 | 'prefix': 'https://reddit.com' 22 | } 23 | return render(request, template_name, context) 24 | -------------------------------------------------------------------------------- /databases/work_with_database/phones/management/commands/import_phones.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | from django.core.management.base import BaseCommand 4 | from phones.models import Phone 5 | 6 | 7 | class Command(BaseCommand): 8 | def add_arguments(self, parser): 9 | pass 10 | 11 | def handle(self, *args, **options): 12 | with open('phones.csv', 'r') as csvfile: 13 | 14 | phone_reader = csv.reader(csvfile, delimiter=';') 15 | # пропускаем заголовок 16 | next(phone_reader) 17 | 18 | for line in phone_reader: 19 | # TODO: Добавьте сохранение модели 20 | pass 21 | -------------------------------------------------------------------------------- /request-handling/file_server/files/server.01: -------------------------------------------------------------------------------- 1 | $ cat /etc/centos-release 2 | CentOS release 6.2 (Final) 3 | 4 | $ lscpu 5 | Architecture: x86_64 6 | CPU op-mode(s): 32-bit, 64-bit 7 | CPU(s): 8 8 | Thread(s) per core: 2 9 | Core(s) per socket: 4 10 | CPU socket(s): 1 11 | NUMA node(s): 1 12 | Vendor ID: GenuineIntel 13 | CPU family: 6 14 | Model: 30 15 | Stepping: 5 16 | CPU MHz: 1199.000 17 | Virtualization: VT-x 18 | L1d cache: 32K 19 | L1i cache: 32K 20 | L2 cache: 256K 21 | L3 cache: 8192K -------------------------------------------------------------------------------- /site-form-works/car_admin/app/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Car(models.Model): 5 | brand = models.CharField(max_length=50) 6 | model = models.CharField(max_length=50) 7 | 8 | def __str__(self): 9 | return f'{self.brand} {self.model}' 10 | 11 | def review_count(self): 12 | return Review.objects.filter(car=self).count() 13 | 14 | 15 | class Review(models.Model): 16 | car = models.ForeignKey(Car, on_delete=models.CASCADE) 17 | title = models.CharField(max_length=100) 18 | text = models.TextField() 19 | 20 | def __str__(self): 21 | return str(self.car) + ' ' + self.title 22 | 23 | -------------------------------------------------------------------------------- /site-personalization/README.md: -------------------------------------------------------------------------------- 1 | Персонализация сайта 2 | === 3 | 4 | Необходимо выполнить и предоставить на проверку следующие задачи: 5 | 6 | 1. [Сессии (cookie)](./sessions/) 7 | 2. [Авторизация и регистрация пользователей](./auth_and_reg_users/) 8 | 9 | Дополнительные задания: 10 | 11 | 1. [Платный контент](./paid_content/) 12 | 13 | Присылать на проверку нужно сразу все обязательные задачи. Дополнительные задачи не влияют на получение зачета. 14 | 15 | Работы должны соответствовать 16 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 17 | 18 | Любые вопросы по решению задач задавайте в группе на Facebook. -------------------------------------------------------------------------------- /request-handling/landing/app/templates/landing_alternate.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | 3 | {% load static %} 4 | 5 | {% block content %} 6 | 7 | 12 | 13 | 14 | 15 |
16 | 17 | Кликни на ссылочку! 18 |
19 | {% endblock %} -------------------------------------------------------------------------------- /site-form-works/review/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Title 7 | {% load static %} 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %} 17 | {% endblock %} 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /request-handling/README.md: -------------------------------------------------------------------------------- 1 | Обработка запросов 2 | === 3 | 4 | Необходимо выполнить и предоставить на проверку следующие задачи: 5 | 6 | 1. [AB-тестирование лендинга (Работа с GET параметрами)](./landing/) 7 | 2. [Пагинация](./pagination/) 8 | 9 | Дополнительные задания: 10 | 1. [Файловый сервер (Работа с менеджером урлов)](./file_server/) 11 | 12 | Присылать на проверку нужно сразу все обязательные задачи. Дополнительные задачи не влияют на получение зачета. 13 | 14 | Работы должны соответствовать 15 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 16 | 17 | Любые вопросы по решению задач задавайте в чате Slack. 18 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/app/views.py: -------------------------------------------------------------------------------- 1 | import time 2 | import random 3 | 4 | from django.shortcuts import render 5 | from django.http import JsonResponse 6 | from django.core.cache import cache 7 | 8 | from .models import City 9 | from .forms import SearchTicket 10 | 11 | 12 | def ticket_page_view(request): 13 | template = 'app/ticket_page.html' 14 | 15 | context = { 16 | 'form': SearchTicket() 17 | } 18 | 19 | return render(request, template, context) 20 | 21 | 22 | def cities_lookup(request): 23 | """Ajax request предлагающий города для автоподстановки, возвращает JSON""" 24 | results = [] 25 | return JsonResponse(results, safe=False) 26 | -------------------------------------------------------------------------------- /creating-project/README.md: -------------------------------------------------------------------------------- 1 | Создание и поддержка проекта 2 | === 3 | 4 | Необходимо выполнить и предоставить на проверку следующие задачи: 5 | 6 | 1. [Выделение приложения](./application/) 7 | 2. [Создание проекта](./project/) 8 | 9 | Дополнительные задания: 10 | 11 | 1. [Управляющие команды (management command) и пользование документацией](./cli_and_doc/) 12 | 13 | Присылать на проверку нужно сразу все обязательные задачи. Дополнительные задачи не влияют на получение зачета. 14 | 15 | Работы должны соответствовать 16 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 17 | 18 | Любые вопросы по решению задач задавайте в группе на Facebook. -------------------------------------------------------------------------------- /site-form-works/README.md: -------------------------------------------------------------------------------- 1 | ## Блок 3. Взаимодействие с сайтом 2 | 3 | 4 | Необходимо выполнить и предоставить на проверку следующие задачи: 5 | 6 | 1. [Админка сайта обзора автомобилей](./car_admin/) 7 | 2. [Обзор товаров](./review/) 8 | 9 | Дополнительные задания: 10 | 11 | 1. [Кредитный калькулятор](./credit_calc/) 12 | 2. [Покупка авиабилетов](./avia_scanner/) 13 | 14 | Присылать на проверку нужно сразу все обязательные задачи. Дополнительные задачи не влияют на получение зачета. 15 | 16 | Работы должны соответствовать 17 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 18 | 19 | Любые вопросы по решению задач задавайте в группе на Facebook. 20 | -------------------------------------------------------------------------------- /request-handling/pagination/app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, redirect 2 | from django.urls import reverse 3 | 4 | 5 | def index(request): 6 | return redirect(reverse(bus_stations)) 7 | 8 | 9 | def bus_stations(request): 10 | current_page = 1 11 | next_page_url = 'write your url' 12 | return render(request, 'index.html', context={ 13 | 'bus_stations': [{'Name': 'название', 'Street': 'улица', 'District': 'район'}, 14 | {'Name': 'другое название', 'Street': 'другая улица', 'District': 'другой район'}], 15 | 'current_page': current_page, 16 | 'prev_page_url': None, 17 | 'next_page_url': next_page_url, 18 | }) 19 | 20 | -------------------------------------------------------------------------------- /dynamic-templates/README.md: -------------------------------------------------------------------------------- 1 | # Динамическое формирование страниц на основе шаблонов 2 | 3 | Необходимо выполнить и предоставить на проверку следующие задачи: 4 | 5 | 6 | 1. [Строим таблицу с данными по инфляции в России](./task1) 7 | 8 | Дополнительные задания: 9 | 10 | 1. [Статический сайт с продажей компьютеров](./task2) 11 | 12 | 2. [Лучшие посты с раздела Python на Reddit](./task3) 13 | 14 | Присылать на проверку нужно сразу все обязательные задачи. Дополнительные задачи не влияют на получение зачета. 15 | 16 | Работы должны соответствовать принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 17 | 18 | Любые вопросы по решению задач задавайте в чате Slack. 19 | -------------------------------------------------------------------------------- /databases/README.md: -------------------------------------------------------------------------------- 1 | Работа с ORM 2 | === 3 | 4 | Необходимо выполнить и предоставить на проверку следующие задачи: 5 | 6 | 1. [Выгрузка каталога товаров из csv-файла с сохранением всех позиций в базе данных](./work_with_database/) 7 | 8 | Дополнительные задания: 9 | 10 | 1. [Сравнение смартфонов по характеристикам](./phone_comparison/) 11 | 2. [Делаем онлайн-библиотеку](./models_list_displaying/) 12 | 13 | Присылать на проверку нужно сразу все обязательные задачи. Дополнительные задачи не влияют на получение зачета. 14 | 15 | Работы должны соответствовать 16 | принятому [стилю оформления кода](https://github.com/netology-code/codestyle/tree/master/python). 17 | 18 | Любые вопросы по решению задач задавайте в чате Slack. 19 | -------------------------------------------------------------------------------- /first-project/first_project/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'first_project.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/app/forms.py: -------------------------------------------------------------------------------- 1 | from django import forms 2 | 3 | 4 | class CalcForm(forms.Form): 5 | initial_fee = forms.IntegerField(label="Стоимость товара") 6 | rate = forms.CharField(label="Процентная ставка") 7 | months_count = forms.IntegerField(label="Срок кредита в месяцах") 8 | 9 | def clean_initial_fee(self): 10 | # валидация одного поля, функция начинающаяся на `clean_` + имя поля 11 | initial_fee = self.cleaned_data.get('initial_fee') 12 | if not initial_fee or initial_fee < 0: 13 | raise forms.ValidationError("Стоимость товара не может быть отрицательной") 14 | return initial_fee 15 | 16 | def clean(self): 17 | # общая функция валидации 18 | return self.cleaned_data 19 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simple_crud.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /django-testing/django_testing/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_testing.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /databases/models_list_displaying/templates/books/books_list.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Каталог книг{% endblock %} 5 | {% block content %} 6 |
7 |
8 |

Каталог

9 |
10 |
11 |
12 |

Сияние

13 |

Автор: Стивен Кинг

14 |

Дата публикации: 2018-09-10

15 |
16 |
17 |

1984

18 |

Автор: Джордж Оруэл

19 |

Дата публикации: 2015-03-11

20 |
21 |
22 |
23 | {% endblock %} -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'api_with_restrictions.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /databases/models_list_displaying/books/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1.1 on 2018-10-07 14:42 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Book', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=64, verbose_name='Название')), 19 | ('author', models.CharField(max_length=64, verbose_name='Автор')), 20 | ('pub_date', models.DateField(verbose_name='Дата публикации')), 21 | ], 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/measurements/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Project(models.Model): 5 | """Объект на котором проводят измерения.""" 6 | 7 | name = models.TextField() 8 | latitude = models.FloatField() 9 | longitude = models.FloatField() 10 | created_at = models.DateTimeField( 11 | auto_now_add=True 12 | ) 13 | updated_at = models.DateTimeField( 14 | auto_now=True 15 | ) 16 | 17 | 18 | class Measurement(models.Model): 19 | """Измерение температуры на объекте.""" 20 | 21 | value = models.FloatField() 22 | project = models.ForeignKey(Project, on_delete=models.CASCADE) 23 | created_at = models.DateTimeField( 24 | auto_now_add=True 25 | ) 26 | updated_at = models.DateTimeField( 27 | auto_now=True 28 | ) 29 | -------------------------------------------------------------------------------- /site-form-works/review/templates/app/product_detail.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |

Товар {{ product.name }}

6 | 7 |

Отзывы:

8 | 13 | {% if is_review_exist %} 14 |

Отзыв от вас уже есть

15 | {% else %} 16 |

Можете добавить отзыв

17 | {% endif %} 18 | 19 |
20 | {% csrf_token %} 21 | {{ form }} 22 |
23 | 24 |
25 |
26 | {% endblock %} 27 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/school/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Teacher(models.Model): 5 | name = models.CharField(max_length=30, verbose_name='Имя') 6 | subject = models.CharField(max_length=10, verbose_name='Предмет') 7 | 8 | class Meta: 9 | verbose_name = 'Учитель' 10 | verbose_name_plural = 'Учителя' 11 | 12 | def __str__(self): 13 | return self.name 14 | 15 | 16 | class Student(models.Model): 17 | name = models.CharField(max_length=30, verbose_name='Имя') 18 | teacher = models.ForeignKey(Teacher, on_delete=models.CASCADE) 19 | group = models.CharField(max_length=10, verbose_name='Класс') 20 | 21 | class Meta: 22 | verbose_name = 'Ученик' 23 | verbose_name_plural = 'Ученики' 24 | 25 | def __str__(self): 26 | return self.name 27 | -------------------------------------------------------------------------------- /dynamic-templates/task2/README.md: -------------------------------------------------------------------------------- 1 | Статический сайт 2 | ===== 3 | 4 | Вам предстоит реализовать статический сайт с каталогом товаров. 5 | 6 | 1. Необходимо выделить базовую страницу. Каждая страница конкретного `view` будет расширять ее и переопределять необходимые блоки. 7 | 8 | 2. Навбар необходимо вынести в базовую страницу. При этом текущая страница должна быть подсвечена в меню. 9 | 10 | 3. Необходимо вынести рендеринг компьютера из `examples.html` в отдельный файл и подключать его через механизм `include`. 11 | https://docs.djangoproject.com/en/2.1/ref/templates/builtins/#include 12 | 13 | 14 | ## Документация по проекту 15 | 16 | Для запуска проекта необходимо: 17 | 18 | Установить зависимости: 19 | 20 | ```bash 21 | pip install -r requirements.txt 22 | ``` 23 | 24 | Выполнить команду: 25 | 26 | ```bash 27 | python manage.py runserver 28 | ``` 29 | -------------------------------------------------------------------------------- /request-handling/file_server/app/templates/_base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | {% block content %} 18 | {% endblock %} 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /creating-project/project/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | {% block title %}{% endblock %}Автобусные остановки на карте 5 | 6 | 7 | 8 | 9 | {% block head %}{% endblock %} 10 | 11 | 12 | {% block content %}{% endblock %} 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /databases_2/orm_query/README.md: -------------------------------------------------------------------------------- 1 | # Работа с базой 2 | 3 | ## Задание 4 | 5 | Каждый маленький сайт может однажды стать большим посещаемым порталом. 6 | С ростом посещаемости размер БД растет и растет время выполнения запроса. 7 | Необходимо оптимизировать запросы, чтобы были исключены запросы к лишним полям. 8 | Подразумевается использование deref, only и select_related. 9 | 10 | 1) Вывести на шаблон дополнительно авторов и жанры. 11 | 2) Используя `defer`, `only`, `select_related` сделать вывод более оптимальным. 12 | 13 | 14 | ## Документация по проекту 15 | 16 | Для запуска проекта необходимо: 17 | 18 | Установить зависимости: 19 | 20 | ```bash 21 | pip install -r requirements.txt 22 | ``` 23 | 24 | Провести миграцию: 25 | 26 | ```bash 27 | python manage.py migrate 28 | ``` 29 | 30 | Запустить отладочный веб-сервер проекта: 31 | 32 | ```bash 33 | python manage.py runserver 34 | ``` 35 | -------------------------------------------------------------------------------- /site-form-works/review/app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import redirect, render, get_object_or_404 2 | from django.urls import reverse 3 | 4 | from .models import Product, Review 5 | from .forms import ReviewForm 6 | 7 | 8 | def product_list_view(request): 9 | template = 'app/product_list.html' 10 | products = Product.objects.all() 11 | 12 | context = { 13 | 'product_list': products, 14 | } 15 | 16 | return render(request, template, context) 17 | 18 | 19 | def product_view(request, pk): 20 | template = 'app/product_detail.html' 21 | product = get_object_or_404(Product, id=pk) 22 | 23 | form = ReviewForm 24 | if request.method == 'POST': 25 | # логика для добавления отзыва 26 | pass 27 | 28 | context = { 29 | 'form': form, 30 | 'product': product 31 | } 32 | 33 | return render(request, template, context) 34 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/templates/app/ticket_page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Магазин авиабилетов 5 | {% load static %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 |
{{ form }}
19 |
20 |
21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /request-handling/landing/app/templates/stats.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | 3 | {% load static %} 4 | 5 | {% block content %} 6 | 7 | 8 |
9 |
10 | 11 | 12 |
13 |
14 |
15 |
Оригинальный вариант
16 | 17 |

Количество переходов к количеству просмотров: {{ original_conversion }}

18 |
19 |
20 |
21 |
22 |
Тестовый вариант
23 | 24 |

Количество переходов к количеству просмотров: {{ test_conversion }}

25 |
26 |
27 |
28 | 29 |
30 |
31 | {% endblock %} -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/models.py: -------------------------------------------------------------------------------- 1 | from django.conf import settings 2 | from django.db import models 3 | 4 | 5 | class AdvertisementStatusChoices(models.TextChoices): 6 | """Статусы объявления.""" 7 | 8 | OPEN = "OPEN", "Открыто" 9 | CLOSED = "CLOSED", "Закрыто" 10 | 11 | 12 | class Advertisement(models.Model): 13 | """Объявление.""" 14 | 15 | title = models.TextField() 16 | description = models.TextField(default='') 17 | status = models.TextField( 18 | choices=AdvertisementStatusChoices.choices, 19 | default=AdvertisementStatusChoices.OPEN 20 | ) 21 | creator = models.ForeignKey( 22 | settings.AUTH_USER_MODEL, 23 | on_delete=models.CASCADE, 24 | ) 25 | created_at = models.DateTimeField( 26 | auto_now_add=True 27 | ) 28 | updated_at = models.DateTimeField( 29 | auto_now=True 30 | ) 31 | -------------------------------------------------------------------------------- /request-handling/landing/static/css/style.css: -------------------------------------------------------------------------------- 1 | nav ul a, 2 | nav .brand-logo { 3 | color: #444; 4 | } 5 | 6 | p { 7 | line-height: 2rem; 8 | } 9 | 10 | .sidenav-trigger { 11 | color: #26a69a; 12 | } 13 | 14 | .parallax-container { 15 | min-height: 380px; 16 | line-height: 0; 17 | height: auto; 18 | color: rgba(255,255,255,.9); 19 | } 20 | .parallax-container .section { 21 | width: 100%; 22 | } 23 | 24 | @media only screen and (max-width : 992px) { 25 | .parallax-container .section { 26 | position: absolute; 27 | top: 40%; 28 | } 29 | #index-banner .section { 30 | top: 10%; 31 | } 32 | } 33 | 34 | @media only screen and (max-width : 600px) { 35 | #index-banner .section { 36 | top: 0; 37 | } 38 | } 39 | 40 | .icon-block { 41 | padding: 0 15px; 42 | } 43 | .icon-block .material-icons { 44 | font-size: inherit; 45 | } 46 | 47 | footer.page-footer { 48 | margin: 0; 49 | } -------------------------------------------------------------------------------- /databases_2/m2m-relations/templates/articles/news.html: -------------------------------------------------------------------------------- 1 | {% extends "articles/base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Новости{% endblock %} 5 | {% block content %} 6 |
7 | {% for article in object_list %} 8 |
9 |
10 | 11 |
12 |

13 | {{ article.title }} 14 |

15 |

{{ article.text }}

16 | {% for scope in article.scopes.all %} 17 | {{ scope.topic }} 18 | {% endfor %} 19 |
20 |
21 |
22 | {% endfor %} 23 |
24 | {% endblock %} -------------------------------------------------------------------------------- /databases_2/orm_query/templates/articles/news.html: -------------------------------------------------------------------------------- 1 | {% extends "articles/base.html" %} 2 | {% load static %} 3 | 4 | {% block title %}Новости{% endblock %} 5 | {% block content %} 6 |
7 | {% for article in object_list %} 8 |
9 |
10 | 11 |
12 |

13 | {{ article.title }} 14 |

15 |

{{ article.text }}

16 | {% for scope in article.scopes.all %} 17 | {{ scope.topic }} 18 | {% endfor %} 19 |
20 |
21 |
22 | {% endfor %} 23 |
24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /site-personalization/sessions/main/urls.py: -------------------------------------------------------------------------------- 1 | """main URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from game import views 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('', views.show_home), 24 | ] 25 | -------------------------------------------------------------------------------- /databases/phone_comparison/main/urls.py: -------------------------------------------------------------------------------- 1 | """main URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from phones.views import show_catalog 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('', show_catalog) 24 | ] 25 | -------------------------------------------------------------------------------- /databases/phone_comparison/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %}{% endblock %} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /databases/work_with_database/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %}{% endblock %} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /dynamic-templates/task1/app/templates/inflation.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | Инфляция в России 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %} 17 |
18 |

Инфляция в России

19 |
20 | 21 | 22 | 23 |
24 |
25 | {% endblock %} 26 | 27 | 28 | -------------------------------------------------------------------------------- /databases/models_list_displaying/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %}{% endblock %} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /site-personalization/paid_content/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %}{% endblock %} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /site-personalization/sessions/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %}{% endblock %} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /databases/models_list_displaying/main/urls.py: -------------------------------------------------------------------------------- 1 | """main URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from books.views import books_view 20 | 21 | urlpatterns = [ 22 | path('', books_view, name='books'), 23 | path('admin/', admin.site.urls), 24 | ] 25 | -------------------------------------------------------------------------------- /dynamic-templates/task1/app/urls.py: -------------------------------------------------------------------------------- 1 | """app URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from .views import inflation_view 20 | 21 | 22 | urlpatterns = [ 23 | path('', inflation_view, name='main'), 24 | path('admin/', admin.site.urls), 25 | ] 26 | -------------------------------------------------------------------------------- /creating-project/application/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %}{% endblock %} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /drf-intro/simple_crud/simple_crud/urls.py: -------------------------------------------------------------------------------- 1 | """simple_crud URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | # TODO: настройте роутер и подключите `ProjectViewSet` и `MeasurementViewSet` 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | ] 24 | -------------------------------------------------------------------------------- /dynamic-templates/task3/app/urls.py: -------------------------------------------------------------------------------- 1 | """filters URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from .views import top_reddit_view 20 | 21 | urlpatterns = [ 22 | path('', top_reddit_view, name='top_reddit'), 23 | path('admin/', admin.site.urls), 24 | ] 25 | -------------------------------------------------------------------------------- /request-handling/file_server/app/views.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | from django.shortcuts import render 4 | 5 | 6 | def file_list(request): 7 | template_name = 'index.html' 8 | 9 | # Реализуйте алгоритм подготавливающий контекстные данные для шаблона по примеру: 10 | context = { 11 | 'files': [ 12 | {'name': 'file_name_1.txt', 13 | 'ctime': datetime.datetime(2018, 1, 1), 14 | 'mtime': datetime.datetime(2018, 1, 2)} 15 | ], 16 | 'date': datetime.date(2018, 1, 1) # Этот параметр необязательный 17 | } 18 | 19 | return render(request, template_name, context) 20 | 21 | 22 | def file_content(request, name): 23 | # Реализуйте алгоритм подготавливающий контекстные данные для шаблона по примеру: 24 | return render( 25 | request, 26 | 'file_content.html', 27 | context={'file_name': 'file_name_1.txt', 'file_content': 'File content!'} 28 | ) 29 | 30 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/templates/base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | {% block title %}{% endblock %} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | {% block content %}{% endblock %} 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /creating-project/application/templates/table.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% load static %} 3 | {% load app_tags %} 4 | {% block title %}CSV: {{ csv_file }}{% endblock %} 5 | {% block content %} 6 |
7 |
8 |

{{ csv_file }}

9 |
10 |
11 | {% for col in columns %} 12 |
13 | {{ col.name }} 14 |
15 | {% endfor %} 16 |
17 | {% for row in table %} 18 |
19 | {% for col in columns %} 20 |
21 | {{ row|get_item:col.name }} 22 |
23 | {% endfor %} 24 |
25 | {% endfor %} 26 |
27 | {% endblock %} -------------------------------------------------------------------------------- /site-form-works/credit_calc/credit_calc/urls.py: -------------------------------------------------------------------------------- 1 | """credit_calc URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from app.views import calc_view 20 | 21 | 22 | urlpatterns = [ 23 | path('admin/', admin.site.urls), 24 | path('', calc_view, name='main') 25 | ] 26 | -------------------------------------------------------------------------------- /request-handling/pagination/app/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | 3 | {% load static %} 4 | 5 | {% block content %} 6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | {% for station in bus_stations %} 18 | 19 | 20 | 21 | 22 | 23 | {% endfor %} 24 | 25 |
NameStreetDistrict
{{ station.Name }}{{ station.Street }}{{ station.District }}
26 | {% if prev_page_url %}{% endif %} 27 | {{ current_page }} 28 | {% if next_page_url %}{% endif %} 29 |
30 |
31 | {% endblock %} -------------------------------------------------------------------------------- /databases/work_with_database/main/urls.py: -------------------------------------------------------------------------------- 1 | """main URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | import phones.views 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('catalog/', phones.views.show_catalog), 24 | path('catalog//', phones.views.show_product), 25 | ] 26 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/requests-examples.http: -------------------------------------------------------------------------------- 1 | # примеры API-запросов 2 | 3 | # получение объявлений 4 | GET localhost:8000/api/advertisements/ 5 | Content-Type: application/json 6 | 7 | ### 8 | # создание объявления 9 | POST localhost:8000/api/advertisements/ 10 | Content-Type: application/json 11 | Authorization: Token 902ef055a9ac93f18327f1f9c45ab059f1a62c7d 12 | 13 | { 14 | "title": "Шкаф IKEA", 15 | "description": "Срочно" 16 | } 17 | 18 | ### 19 | 20 | # попытка поменять объявление 21 | PATCH localhost:8000/api/advertisements/1/ 22 | Content-Type: application/json 23 | Authorization: Token 902ef055a9ac93f18327f1f9c45ab059f1a62c7d 24 | 25 | { 26 | "status": "CLOSED" 27 | } 28 | 29 | ### 30 | 31 | # фильтрация по создателю 32 | GET localhost:8000/api/advertisements/?creator=3 33 | Content-Type: application/json 34 | 35 | ### 36 | 37 | # фильтрация по дате 38 | GET localhost:8000/api/advertisements/?created_at_before=2020-10-01 39 | Content-Type: application/json 40 | 41 | ### 42 | -------------------------------------------------------------------------------- /request-handling/pagination/app/templates/_base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | 7 | 8 | Title 9 | 10 | 11 | 12 | 14 | 15 | 16 | 18 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | {% block content %} 28 | {% endblock %} 29 | 30 | 31 | -------------------------------------------------------------------------------- /site-personalization/auth_and_reg_users/main/urls.py: -------------------------------------------------------------------------------- 1 | """main URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.contrib.auth import views as auth_views 18 | from django.urls import path 19 | 20 | import auth.views 21 | 22 | urlpatterns = [ 23 | path('', auth.views.home), 24 | path('admin/', admin.site.urls), 25 | path('signup/', auth.views.signup), 26 | ] 27 | -------------------------------------------------------------------------------- /creating-project/application/app/urls.py: -------------------------------------------------------------------------------- 1 | """app URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.http import HttpResponseRedirect 18 | from django.urls import path 19 | from .views import table_view 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('table/', table_view), 24 | path('', lambda x: HttpResponseRedirect('/table/')), 25 | ] 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Материалы для домашних работ по курсу «Django» 2 | 3 | ## Блок 1. Обработка запросов. Работа с шаблонами 4 | 5 | 1.1. [Знакомство с Django. Подготовка и запуск проекта.](./first-project) 6 | 7 | 1.2. [Обработка запросов](./request-handling/) 8 | 9 | 1.3. [Динамическое формирование страниц на основе шаблонов](./dynamic-templates/) 10 | 11 | ## Блок 2. Базы данных 12 | 13 | 2.1. [Базы данных](./databases/) 14 | 15 | 2.2. [Базы данных 2](./databases_2/) 16 | 17 | ## Блок 3. Взаимодействие с сайтом 18 | 19 | 3.1. [Знакомство с API на примере Django REST framework](./drf-intro/) 20 | 21 | 3.2. [Django REST framework: фильтрация, валидация и аутентификация](./drf-auth-and-validation/) 22 | 23 | 3.3. [Тестирование Django-приложений с использованием Pytest](./django-testing/) 24 | 25 | ## Требования 26 | 27 | + браузер; 28 | + редактор кода или IDE, например Pycharm; 29 | + система контроля версий git, установленная локально; 30 | + аккаунт на GitHub; 31 | 32 | ## Как работать с репозиторием 33 | 34 | Описано [здесь](/HOW_TO_WORK.md) 35 | -------------------------------------------------------------------------------- /site-personalization/paid_content/main/urls.py: -------------------------------------------------------------------------------- 1 | """main URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.conf.urls import url 17 | from django.contrib import admin 18 | from django.urls import path 19 | 20 | from articles import views 21 | 22 | urlpatterns = [ 23 | path('admin/', admin.site.urls), 24 | path('articles/', views.show_articles), 25 | url(r'^articles/(?P[0-9]+)/', views.show_article), 26 | ] 27 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/avia_scanner/urls.py: -------------------------------------------------------------------------------- 1 | """avia_scanner URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | from app.views import ticket_page_view, cities_lookup 20 | 21 | 22 | urlpatterns = [ 23 | path('admin/', admin.site.urls), 24 | path('api/city_ajax', cities_lookup), 25 | path('', ticket_page_view, name='tickets'), 26 | ] 27 | -------------------------------------------------------------------------------- /site-form-works/credit_calc/templates/app/calc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Калькулятор 4 | {% load static %} 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | {% for field in form %} 15 |

{{ field.label_tag }}

{{ field }} 16 | {{ field.errors }} 17 | {% endfor %} 18 | 19 |
20 |
21 |
22 | {% if result %} 23 |

Сумма: {{common_result}}, в месяц: {{ result }}

24 | {% endif %} 25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /databases_2/orm_query/website/urls.py: -------------------------------------------------------------------------------- 1 | """website URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.conf import settings 17 | from django.conf.urls.static import static 18 | from django.contrib import admin 19 | from django.urls import path, include 20 | 21 | urlpatterns = [ 22 | path('', include('articles.urls')), 23 | path('admin/', admin.site.urls), 24 | ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 25 | -------------------------------------------------------------------------------- /django-testing/django_testing/students/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.2 on 2020-11-01 23:21 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Student', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.TextField()), 19 | ('birth_date', models.DateField(null=True)), 20 | ], 21 | ), 22 | migrations.CreateModel( 23 | name='Course', 24 | fields=[ 25 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 26 | ('name', models.TextField()), 27 | ('students', models.ManyToManyField(to='students.Student')), 28 | ], 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /dynamic-templates/task2/app/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | 4 | def home_view(request): 5 | template_name = 'app/home.html' 6 | return render(request, template_name) 7 | 8 | 9 | def about_view(request): 10 | template_name = 'app/about.html' 11 | return render(request, template_name) 12 | 13 | 14 | def contacts_view(request): 15 | template_name = 'app/contacts.html' 16 | return render(request, template_name) 17 | 18 | 19 | def examples_view(request): 20 | template_name = 'app/examples.html' 21 | 22 | items = [{ 23 | 'title': 'Apple II', 24 | 'text': 'Легенда', 25 | 'img': 'ii.jpg' 26 | }, { 27 | 'title': 'Macintosh', 28 | 'text': 'Свежие новинки октября 1983-го', 29 | 'img': 'mac.jpg' 30 | }, { 31 | 'title': 'iMac', 32 | 'text': 'Оригинальный и прозрачный', 33 | 'img': 'imac.jpg' 34 | }] 35 | context = { 36 | 'items': items 37 | } 38 | return render(request, template_name, 39 | context) 40 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/website/urls.py: -------------------------------------------------------------------------------- 1 | """website URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.conf import settings 17 | from django.conf.urls.static import static 18 | from django.contrib import admin 19 | from django.urls import path, include 20 | 21 | urlpatterns = [ 22 | path('', include('articles.urls')), 23 | path('admin/', admin.site.urls), 24 | ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 25 | -------------------------------------------------------------------------------- /databases_2/orm_migrations/website/urls.py: -------------------------------------------------------------------------------- 1 | """website URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.conf import settings 17 | from django.conf.urls.static import static 18 | from django.contrib import admin 19 | from django.urls import path, include 20 | 21 | urlpatterns = [ 22 | path('', include('school.urls')), 23 | path('admin/', admin.site.urls), 24 | ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 25 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/articles/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.0.5 on 2018-09-30 20:46 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Article', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=256, verbose_name='Название')), 19 | ('text', models.TextField(verbose_name='Текст')), 20 | ('published_at', models.DateTimeField(verbose_name='Дата публикации')), 21 | ('image', models.ImageField(blank=True, null=True, upload_to='', verbose_name='Изображение')), 22 | ], 23 | options={ 24 | 'verbose_name': 'Статья', 25 | 'verbose_name_plural': 'Статьи', 26 | }, 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /site-form-works/car_admin/car_admin/urls.py: -------------------------------------------------------------------------------- 1 | """car_admin URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from django.conf import settings 19 | from django.conf.urls.static import static 20 | 21 | urlpatterns = [ 22 | path('admin/', admin.site.urls), 23 | path('ckeditor/', include('ckeditor_uploader.urls')), 24 | ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) 25 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/api_with_restrictions/urls.py: -------------------------------------------------------------------------------- 1 | """api_with_restrictions URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | from rest_framework.routers import DefaultRouter 20 | 21 | router = DefaultRouter() 22 | # TODO: подключите `AdvertisementViewSet` 23 | 24 | 25 | urlpatterns = [ 26 | path('api/', include(router.urls)), 27 | path('admin/', admin.site.urls), 28 | ] 29 | -------------------------------------------------------------------------------- /site-form-works/car_admin/app/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1.1 on 2018-09-24 22:39 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Car', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('brand', models.CharField(max_length=50)), 20 | ('model', models.CharField(max_length=50)), 21 | ], 22 | ), 23 | migrations.CreateModel( 24 | name='Review', 25 | fields=[ 26 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 27 | ('text', models.TextField()), 28 | ('car', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.Car')), 29 | ], 30 | ), 31 | ] 32 | -------------------------------------------------------------------------------- /first-project/first_project/app/views.py: -------------------------------------------------------------------------------- 1 | from django.http import HttpResponse 2 | from django.shortcuts import render, reverse 3 | 4 | 5 | def home_view(request): 6 | template_name = 'app/home.html' 7 | # впишите правильные адреса страниц, используя 8 | # функцию `reverse` 9 | pages = { 10 | 'Главная страница': reverse('home'), 11 | 'Показать текущее время': '', 12 | 'Показать содержимое рабочей директории': '' 13 | } 14 | 15 | # context и параметры render менять не нужно 16 | # подбробнее о них мы поговорим на следующих лекциях 17 | context = { 18 | 'pages': pages 19 | } 20 | return render(request, template_name, context) 21 | 22 | 23 | def time_view(request): 24 | # обратите внимание – здесь HTML шаблона нет, 25 | # возвращается просто текст 26 | current_time = None 27 | msg = f'Текущее время: {current_time}' 28 | return HttpResponse(msg) 29 | 30 | 31 | def workdir_view(request): 32 | # по аналогии с `time_view`, напишите код, 33 | # который возвращает список файлов в рабочей 34 | # директории 35 | raise NotImplemented 36 | -------------------------------------------------------------------------------- /request-handling/landing/app/templates/_base.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {% block content %} 19 | {% endblock %} 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /django-testing/django_testing/django_testing/urls.py: -------------------------------------------------------------------------------- 1 | """django_testing URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | from rest_framework.routers import DefaultRouter 19 | 20 | from students.views import CoursesViewSet 21 | 22 | router = DefaultRouter() 23 | router.register("courses", CoursesViewSet, basename="courses") 24 | 25 | urlpatterns = [ 26 | path('admin/', admin.site.urls), 27 | path("api/v1/", include(router.urls)), 28 | ] 29 | -------------------------------------------------------------------------------- /site-form-works/review/app/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1.1 on 2018-09-29 09:41 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Product', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('name', models.CharField(max_length=50)), 20 | ('img', models.FileField(upload_to='images/%Y/%m/%d/')), 21 | ], 22 | ), 23 | migrations.CreateModel( 24 | name='Review', 25 | fields=[ 26 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 27 | ('text', models.TextField()), 28 | ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='app.Product')), 29 | ], 30 | ), 31 | ] 32 | -------------------------------------------------------------------------------- /dynamic-templates/task2/app/urls.py: -------------------------------------------------------------------------------- 1 | """app URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | from .views import home_view, about_view, contacts_view, \ 20 | examples_view 21 | 22 | 23 | urlpatterns = [ 24 | path('', home_view, name='home'), 25 | path('about/', about_view, name='about'), 26 | path('contacts/', contacts_view, name='contacts'), 27 | path('examples/', examples_view, name='examples'), 28 | path('admin/', admin.site.urls), 29 | ] 30 | -------------------------------------------------------------------------------- /first-project/first_project/first_project/urls.py: -------------------------------------------------------------------------------- 1 | """first_project URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | from app.views import home_view 20 | 21 | 22 | urlpatterns = [ 23 | path('', home_view, name='home'), 24 | # Раскомментируйте код, чтобы данные урлы 25 | # обрабатывались Django 26 | # path('current_time/', time_view, name='time'), 27 | # path('workdir/', workdir_view, name='workdir'), 28 | path('admin/', admin.site.urls), 29 | ] 30 | -------------------------------------------------------------------------------- /creating-project/application/app/views.py: -------------------------------------------------------------------------------- 1 | import csv 2 | 3 | from django.shortcuts import render 4 | 5 | 6 | CSV_FILENAME = 'phones.csv' 7 | COLUMNS = [ 8 | {'name': 'id', 'width': 1}, 9 | {'name': 'name', 'width': 3}, 10 | {'name': 'price', 'width': 2}, 11 | {'name': 'release_date', 'width': 2}, 12 | {'name': 'lte_exists', 'width': 1}, 13 | ] 14 | 15 | 16 | def table_view(request): 17 | template = 'table.html' 18 | with open(CSV_FILENAME, 'rt') as csv_file: 19 | header = [] 20 | table = [] 21 | table_reader = csv.reader(csv_file, delimiter=';') 22 | for table_row in table_reader: 23 | if not header: 24 | header = {idx: value for idx, value in enumerate(table_row)} 25 | else: 26 | row = {header.get(idx) or 'col{:03d}'.format(idx): value 27 | for idx, value in enumerate(table_row)} 28 | table.append(row) 29 | 30 | context = { 31 | 'columns': COLUMNS, 32 | 'table': table, 33 | 'csv_file': CSV_FILENAME 34 | } 35 | result = render(request, template, context) 36 | return result 37 | -------------------------------------------------------------------------------- /request-handling/pagination/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Пагинация 3 | 4 | ## Задание 5 | 6 | 7 | Реализуйте пагинацию по csv файлу с [портала открытых данных](https://data.mos.ru/datasets/752), 8 | содержащего список остановок наземного общественного транспорта. 9 | 10 | Для этого необходимо реализовать функцию отображение `app.views.bus_stations`, 11 | формируя контекст, как показано в примере. 12 | 13 | Путь к файлу хранится в настройках `settings.BUS_STATION_CSV`. 14 | Для чтения csv файла можете использовать 15 | [DictReader](https://docs.python.org/3/library/csv.html#csv.DictReader) 16 | и учтите, что файл в кодировке cp1251 17 | 18 | Для формирования url'а с get параметром помимо 19 | [reverse](https://docs.djangoproject.com/fr/2.1/ref/urlresolvers/#reverse) используйте 20 | [`urllib.parse.urlencode`](https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlencode) 21 | 22 | ![Пример результата](./res/result.png) 23 | 24 | 25 | ## Документация по проекту 26 | 27 | Для запуска проекта необходимо: 28 | 29 | Установить зависимости: 30 | 31 | ```bash 32 | pip install -r requirements.txt 33 | ``` 34 | 35 | Выполнить команду: 36 | 37 | ```bash 38 | python manage.py runserver 39 | ``` 40 | -------------------------------------------------------------------------------- /site-form-works/review/product_review/urls.py: -------------------------------------------------------------------------------- 1 | """product_review URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/2.1/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from django.conf import settings 19 | from django.conf.urls.static import static 20 | 21 | from app.views import product_list_view, product_view 22 | 23 | 24 | urlpatterns = [ 25 | path('admin/', admin.site.urls), 26 | path('product//', product_view, name='product_detail'), 27 | path('', product_list_view, name='main_page'), 28 | ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 29 | -------------------------------------------------------------------------------- /request-handling/file_server/files/server.02: -------------------------------------------------------------------------------- 1 | $ lsb_release -a 2 | No LSB modules are available. 3 | Distributor ID: Ubuntu 4 | Description: Ubuntu 14.04.1 LTS 5 | Release: 14.04 6 | Codename: trusty 7 | 8 | $ cat /proc/cpuinfo 9 | processor : 0 10 | vendor_id : GenuineIntel 11 | cpu family : 15 12 | model : 4 13 | model name : Intel(R) Xeon(TM) CPU 3.00GHz 14 | stepping : 3 15 | cpu MHz : 2992.991 16 | cache size : 2048 KB 17 | physical id : 0 18 | siblings : 2 19 | fdiv_bug : no 20 | hlt_bug : no 21 | f00f_bug : no 22 | coma_bug : no 23 | fpu : yes 24 | fpu_exception : yes 25 | cpuid level : 5 26 | wp : yes 27 | flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 28 | ss ht tm pbe nx lm pni monitor ds_cpl cid 29 | bogomips : 5931.00 30 | 31 | processor : 1 32 | vendor_id : GenuineIntel 33 | cpu family : 15 34 | model : 4 35 | model name : Intel(R) Xeon(TM) CPU 3.00GHz 36 | stepping : 3 37 | cpu MHz : 2992.991 38 | cache size : 2048 KB 39 | physical id : 0 40 | siblings : 2 -------------------------------------------------------------------------------- /HOW_TO_WORK.md: -------------------------------------------------------------------------------- 1 | Как работать с репозиторием 2 | ====== 3 | 4 | # Начало работ 5 | 6 | 7 | ## Способ 1 (простой) 8 | 9 | Скачайте репозиторий локально, откройте директорию с содержимым домашней работы и скопируйте ее в свой репозиторий. 10 | 11 | 12 | ## Способ 2 (более продвинутый) 13 | 14 | - Клонируйте репозиторий с домашними заданиями git clone https://github.com/netology-code/dj-homeworks.git. 15 | - Перейти в папку cd ./dj-homeworks. 16 | - Создать репозиторий на GitHub (репозиторий должен быть открытый). 17 | - Добавить репозиторий в проект remote set-url origin %repo-url%, где %repo-url% — адрес созданного репозитория. 18 | 19 | 20 | # Как выполнять домашние задания 21 | 22 | 1. Перейти в папку задания, например, для первой задачи первого задания `cd ./first-project/first_project`. 23 | 2. Выполнить задание. 24 | 3. Опубликовать код в репозиторий homeworks с помощью команды `git push origin master`. 25 | 4. Прислать ссылку на директорию с решением в вашем репозитории через личный кабинет на сайте Нетологии. 26 | 27 | Каждое задание выполнять как отдельный проект в Pycharm или другом редакторе. В качестве корневой директории укажите директорию проекта. Например, это `./dj-homeworks/first-project/first_project/` для первого ДЗ. 28 | -------------------------------------------------------------------------------- /request-handling/file_server/app/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | 3 | {% block content %} 4 |

Список отчетов:

5 | {% if date %} 6 |

{{ date }}

7 | Убрать фильтр по дате 8 | {% endif %} 9 |
    10 | {% for f in files %} 11 |
  • 12 | insert_chart 13 | {{ f.name }} 14 |

    15 | Создан: {% if date == f.ctime.date %} 16 | {{ f.ctime }} 17 | {% else %} 18 | {{ f.ctime.date }} {{ f.mtime.time }} 19 | {% endif %} 20 |
    21 | Изменен: {% if date == f.mtime.date %} 22 | {{ f.mtime }} 23 | {% else %} 24 | {{ f.mtime.date }} {{ f.mtime.time }} 25 | {% endif %} 26 |

    27 |
  • 28 | {% empty %} 29 | Нет подходящих файлов 30 | {% endfor %} 31 |
32 | {% endblock %} 33 | -------------------------------------------------------------------------------- /drf-auth-and-validation/api_with_restrictions/advertisements/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.2 on 2020-10-12 02:26 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Advertisement', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('title', models.TextField()), 22 | ('description', models.TextField(default='')), 23 | ('status', models.TextField(choices=[('OPEN', 'Открыто'), ('CLOSED', 'Закрыто')], default='OPEN')), 24 | ('created_at', models.DateTimeField(auto_now_add=True)), 25 | ('updated_at', models.DateTimeField(auto_now=True)), 26 | ('creator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 27 | ], 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /site-form-works/avia_scanner/static/css/avia.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #96f226; 3 | font-size: 36px; 4 | width: 108px; 5 | } 6 | #clickme { 7 | border-radius: 0; 8 | color: #96f226; 9 | } 10 | #clickme:hover { 11 | cursor: pointer; 12 | } 13 | #clickme:active { 14 | box-shadow: 0 0 30px #96f226 15 | } 16 | #input { 17 | border-radius: 0; 18 | color: #96f226; 19 | width: 300px; 20 | } 21 | #input:hover { 22 | background: #656565 23 | } 24 | #input:active { 25 | box-shadow: 0 0 30px #96f226 26 | } 27 | #input:focus { 28 | box-shadow: 0 0 30px #96f226 29 | } 30 | .ui-tooltip { 31 | color: #96f226; 32 | border-radius: 0; 33 | box-shadow: 0 0 34 | } 35 | .ui-autocomplete { 36 | background: #c7c9ff; 37 | border-radius: 0; 38 | width: 200px; 39 | } 40 | .ui-autocomplete.source:hover { 41 | background: #f0f531; 42 | } 43 | .ui-helper-hidden-accessible { 44 | display:none; 45 | } 46 | 47 | .ui-menu .ui-menu-item a{ 48 | background:red; 49 | height:10px; 50 | font-size:8px; 51 | } 52 | 53 | .padding-top{ 54 | padding-top: 24px; 55 | } 56 | 57 | .inline { 58 | display: inline; 59 | } 60 | .right-margin { 61 | margin-right: 24px; 62 | } 63 | .schampane { 64 | background-color: BlanchedAlmond; 65 | } -------------------------------------------------------------------------------- /request-handling/landing/app/views.py: -------------------------------------------------------------------------------- 1 | from collections import Counter 2 | 3 | from django.shortcuts import render 4 | 5 | # Для отладки механизма ab-тестирования используйте эти счетчики 6 | # в качестве хранилища количества показов и количества переходов. 7 | # но помните, что в реальных проектах так не стоит делать 8 | # так как при перезапуске приложения они обнулятся 9 | counter_show = Counter() 10 | counter_click = Counter() 11 | 12 | 13 | def index(request): 14 | # Реализуйте логику подсчета количества переходов с лендига по GET параметру from-landing 15 | return render(request, 'index.html') 16 | 17 | 18 | def landing(request): 19 | # Реализуйте дополнительное отображение по шаблону app/landing_alternate.html 20 | # в зависимости от GET параметра ab-test-arg 21 | # который может принимать значения original и test 22 | # Так же реализуйте логику подсчета количества показов 23 | return render(request, 'landing.html') 24 | 25 | 26 | def stats(request): 27 | # Реализуйте логику подсчета отношения количества переходов к количеству показов страницы 28 | # Для вывода результат передайте в следующем формате: 29 | return render(request, 'stats.html', context={ 30 | 'test_conversion': 0.5, 31 | 'original_conversion': 0.4, 32 | }) 33 | -------------------------------------------------------------------------------- /dynamic-templates/task2/app/templates/app/home.html: -------------------------------------------------------------------------------- 1 | {% load static %} 2 | 3 | 4 | 5 | Заголовок 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 27 | 28 |
29 |
30 |

Компьютеры Apple

31 | Apple 32 |
33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /databases_2/orm_query/articles/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Genre(models.Model): 5 | 6 | name = models.CharField(max_length=256, verbose_name='Название') 7 | 8 | class Meta: 9 | verbose_name = 'Жанр' 10 | verbose_name_plural = 'Жанры' 11 | 12 | def __str__(self): 13 | return self.name 14 | 15 | 16 | class Author(models.Model): 17 | 18 | name = models.CharField(max_length=256, verbose_name='Имя') 19 | phone = models.CharField(max_length=256, verbose_name='Телефон') 20 | 21 | class Meta: 22 | verbose_name = 'Автор' 23 | verbose_name_plural = 'Авторы' 24 | 25 | def __str__(self): 26 | return self.name 27 | 28 | 29 | class Article(models.Model): 30 | 31 | author = models.ForeignKey(Author, on_delete=models.CASCADE) 32 | genre = models.ForeignKey(Genre, on_delete=models.CASCADE) 33 | title = models.CharField(max_length=256, verbose_name='Название') 34 | text = models.TextField(verbose_name='Текст') 35 | published_at = models.DateTimeField(verbose_name='Дата публикации') 36 | image = models.ImageField(null=True, blank=True, verbose_name='Изображение',) 37 | 38 | 39 | class Meta: 40 | verbose_name = 'Статья' 41 | verbose_name_plural = 'Статьи' 42 | 43 | def __str__(self): 44 | return self.title 45 | -------------------------------------------------------------------------------- /databases_2/orm_query/templates/articles/base.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | {% block title %}{% endblock %} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 |
{% block content %}{% endblock %}
28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /databases_2/m2m-relations/templates/articles/base.html: -------------------------------------------------------------------------------- 1 | 2 | {% load static %} 3 | 4 | 5 | 6 | {% block title %}{% endblock %} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 27 |
{% block content %}{% endblock %}
28 | 29 | 30 | 31 | 32 | 33 | 34 | --------------------------------------------------------------------------------