├── chapter02 └── Alexandria │ ├── tests │ ├── __init__.py │ └── test_primer.py │ ├── Alexandria │ ├── __init__.py │ ├── urls.py │ ├── asgi.py │ └── wsgi.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── runserver.sh │ ├── resetdb.sh │ ├── credits.md │ └── manage.py ├── chapter03 └── Alexandria │ ├── home │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── tests │ ├── __init__.py │ ├── test_primer.py │ └── test_home.py │ ├── Alexandria │ ├── __init__.py │ ├── asgi.py │ ├── wsgi.py │ └── urls.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── runserver.sh │ ├── resetdb.sh │ ├── static │ ├── logo.png │ ├── favicon.ico │ └── css │ │ └── site.css │ ├── templates │ ├── home.html │ ├── about.html │ ├── book_listing.html │ └── sample.html │ ├── credits.md │ └── manage.py ├── chapter04 └── Alexandria │ ├── home │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── tests │ ├── __init__.py │ ├── test_primer.py │ └── test_home.py │ ├── Alexandria │ ├── __init__.py │ ├── asgi.py │ ├── wsgi.py │ └── urls.py │ ├── catalog │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── admin.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ ├── views.py │ └── models.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── runserver.sh │ ├── static │ ├── logo.png │ ├── favicon.ico │ └── css │ │ └── site.css │ ├── resetdb.sh │ ├── templates │ ├── about.html │ ├── home.html │ ├── book_listing.html │ └── sample.html │ ├── credits.md │ └── manage.py ├── chapter05 └── Alexandria │ ├── home │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── tests │ ├── __init__.py │ ├── test_primer.py │ └── test_home.py │ ├── Alexandria │ ├── __init__.py │ ├── asgi.py │ ├── wsgi.py │ └── urls.py │ ├── catalog │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── runserver.sh │ ├── static │ ├── logo.png │ ├── favicon.ico │ └── css │ │ └── site.css │ ├── resetdb.sh │ ├── templates │ ├── about.html │ ├── home.html │ ├── book_listing.html │ └── sample.html │ ├── credits.md │ └── manage.py ├── chapter06 └── Alexandria │ ├── home │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── tests │ ├── __init__.py │ ├── test_primer.py │ ├── test_people.py │ └── test_home.py │ ├── Alexandria │ ├── __init__.py │ ├── asgi.py │ ├── wsgi.py │ └── urls.py │ ├── catalog │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── people │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ └── admin.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── runserver.sh │ ├── static │ ├── logo.png │ ├── favicon.ico │ └── css │ │ └── site.css │ ├── templates │ ├── registration │ │ ├── password_change_done.html │ │ ├── password_reset_complete.html │ │ ├── login.html │ │ ├── password_reset_email.html │ │ └── password_reset_done.html │ ├── about.html │ ├── profile.html │ ├── home.html │ ├── profile_listing.html │ ├── book_listing.html │ ├── 404.html │ └── sample.html │ ├── resetdb.sh │ ├── credits.md │ └── manage.py ├── chapter07 └── Alexandria │ ├── home │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── tests │ ├── __init__.py │ ├── test_primer.py │ ├── test_people.py │ └── test_home.py │ ├── Alexandria │ ├── __init__.py │ ├── asgi.py │ ├── wsgi.py │ └── urls.py │ ├── catalog │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ └── views.py │ ├── people │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ └── urls.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── review │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ ├── forms.py │ └── models.py │ ├── runserver.sh │ ├── static │ ├── logo.png │ ├── favicon.ico │ └── css │ │ └── site.css │ ├── templates │ ├── registration │ │ ├── password_change_done.html │ │ ├── password_reset_complete.html │ │ ├── login.html │ │ ├── password_reset_email.html │ │ └── password_reset_done.html │ ├── about.html │ ├── profile.html │ ├── home.html │ ├── profile_listing.html │ ├── 404.html │ ├── book_listing.html │ └── sample.html │ ├── resetdb.sh │ ├── credits.md │ └── manage.py ├── chapter08 ├── Alexandria │ ├── home │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── tests.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── urls.py │ │ └── views.py │ ├── tests │ │ ├── __init__.py │ │ ├── data │ │ │ └── Michael.jpg │ │ ├── test_primer.py │ │ ├── test_people.py │ │ └── test_home.py │ ├── Alexandria │ │ ├── __init__.py │ │ ├── asgi.py │ │ └── wsgi.py │ ├── catalog │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── apps.py │ │ └── urls.py │ ├── people │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── apps.py │ │ └── urls.py │ ├── primer │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── tests.py │ │ ├── admin.py │ │ ├── apps.py │ │ └── views.py │ ├── review │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── urls.py │ │ ├── forms.py │ │ └── models.py │ ├── runserver.sh │ ├── static │ │ ├── logo.png │ │ ├── favicon.ico │ │ └── css │ │ │ └── site.css │ ├── templates │ │ ├── registration │ │ │ ├── password_change_done.html │ │ │ ├── password_reset_complete.html │ │ │ ├── login.html │ │ │ ├── password_reset_email.html │ │ │ └── password_reset_done.html │ │ ├── about.html │ │ ├── profile.html │ │ ├── profile_listing.html │ │ ├── home.html │ │ ├── 404.html │ │ ├── author_listing.html │ │ ├── book_listing.html │ │ ├── sample.html │ │ ├── pages.html │ │ └── upload_author_photo.html │ ├── README_NOW_FIX_FIXTURE.txt │ ├── credits.md │ ├── resetdb.sh │ └── manage.py └── uploads │ └── Alexandria │ ├── Hemingway.jpg │ └── 1_Conan_Doyle.jpg ├── chapter09 ├── Alexandria │ ├── home │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── tests.py │ │ ├── admin.py │ │ ├── apps.py │ │ ├── urls.py │ │ └── views.py │ ├── tests │ │ ├── __init__.py │ │ ├── data │ │ │ └── Michael.jpg │ │ ├── test_primer.py │ │ ├── test_people.py │ │ └── test_home.py │ ├── Alexandria │ │ ├── __init__.py │ │ ├── asgi.py │ │ └── wsgi.py │ ├── catalog │ │ ├── __init__.py │ │ ├── management │ │ │ ├── __init__.py │ │ │ └── commands │ │ │ │ ├── __init__.py │ │ │ │ └── authors.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── apps.py │ │ └── urls.py │ ├── people │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── apps.py │ │ └── urls.py │ ├── primer │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── models.py │ │ ├── tests.py │ │ ├── admin.py │ │ ├── apps.py │ │ └── views.py │ ├── review │ │ ├── __init__.py │ │ ├── migrations │ │ │ └── __init__.py │ │ ├── tests.py │ │ ├── apps.py │ │ ├── urls.py │ │ ├── forms.py │ │ └── models.py │ ├── runserver.sh │ ├── static │ │ ├── logo.png │ │ ├── favicon.ico │ │ └── css │ │ │ └── site.css │ ├── templates │ │ ├── registration │ │ │ ├── password_change_done.html │ │ │ ├── password_reset_complete.html │ │ │ ├── login.html │ │ │ ├── password_reset_email.html │ │ │ └── password_reset_done.html │ │ ├── about.html │ │ ├── profile.html │ │ ├── profile_listing.html │ │ ├── home.html │ │ ├── 404.html │ │ ├── author_listing.html │ │ ├── book_listing.html │ │ ├── sample.html │ │ ├── pages.html │ │ └── upload_author_photo.html │ ├── credits.md │ ├── resetdb.sh │ └── manage.py └── uploads │ └── Alexandria │ ├── Hemingway.jpg │ └── 1_Conan_Doyle.jpg ├── chapter10 └── Alexandria │ ├── home │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── urls.py │ ├── music │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0002_song_artist_name.py │ │ ├── 0001_initial.py │ │ └── 0001_initial_squashed_0002_song_artist_name.py │ ├── tests.py │ ├── admin.py │ ├── views.py │ ├── apps.py │ └── models.py │ ├── tests │ ├── __init__.py │ ├── data │ │ └── Michael.jpg │ ├── test_primer.py │ ├── test_people.py │ └── test_home.py │ ├── Alexandria │ ├── __init__.py │ ├── asgi.py │ └── wsgi.py │ ├── catalog │ ├── __init__.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── authors.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ └── urls.py │ ├── people │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ └── urls.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── review │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ ├── forms.py │ └── models.py │ ├── runserver.sh │ ├── static │ ├── logo.png │ ├── favicon.ico │ └── css │ │ └── site.css │ ├── templates │ ├── registration │ │ ├── password_change_done.html │ │ ├── password_reset_complete.html │ │ ├── login.html │ │ ├── password_reset_email.html │ │ └── password_reset_done.html │ ├── about.html │ ├── profile.html │ ├── profile_listing.html │ ├── home.html │ ├── 404.html │ ├── author_listing.html │ ├── book_listing.html │ ├── sample.html │ ├── pages.html │ └── upload_author_photo.html │ ├── credits.md │ ├── resetdb.sh │ └── manage.py ├── chapter12 └── Alexandria │ ├── home │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── urls.py │ ├── music │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── 0002_song_artist_name.py │ │ ├── 0001_initial.py │ │ └── 0001_initial_squashed_0002_song_artist_name.py │ ├── tests.py │ ├── admin.py │ ├── views.py │ ├── apps.py │ └── models.py │ ├── tests │ ├── __init__.py │ ├── data │ │ └── Michael.jpg │ ├── test_primer.py │ ├── test_people.py │ └── test_home.py │ ├── Alexandria │ ├── __init__.py │ ├── asgi.py │ └── wsgi.py │ ├── catalog │ ├── __init__.py │ ├── management │ │ ├── __init__.py │ │ └── commands │ │ │ ├── __init__.py │ │ │ └── authors.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── serializers.py │ └── urls.py │ ├── people │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ └── urls.py │ ├── primer │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── admin.py │ ├── apps.py │ └── views.py │ ├── review │ ├── __init__.py │ ├── migrations │ │ └── __init__.py │ ├── tests.py │ ├── apps.py │ ├── urls.py │ ├── forms.py │ └── models.py │ ├── runserver.sh │ ├── static │ ├── logo.png │ ├── favicon.ico │ └── css │ │ └── site.css │ ├── templates │ ├── registration │ │ ├── password_change_done.html │ │ ├── password_reset_complete.html │ │ ├── login.html │ │ ├── password_reset_email.html │ │ └── password_reset_done.html │ ├── about.html │ ├── profile.html │ ├── profile_listing.html │ ├── home.html │ ├── 404.html │ ├── author_listing.html │ ├── book_listing.html │ ├── sample.html │ ├── pages.html │ └── upload_author_photo.html │ ├── credits.md │ ├── resetdb.sh │ └── manage.py ├── data ├── logo.png ├── Homer.jpg ├── favicon.ico ├── Hemingway.jpg ├── Conan_Doyle.jpg └── ch04.json ├── assets ├── logo.png └── favicon.ico └── requirements.txt /chapter02/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter03/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter03/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/home/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter02/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter02/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter03/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter03/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/people/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/people/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/review/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/people/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/review/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/people/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/review/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/people/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/review/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/Alexandria/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/people/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/primer/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/review/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter03/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/home/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter02/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter03/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter04/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter05/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/people/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter06/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/people/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter07/Alexandria/review/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/people/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter08/Alexandria/review/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/people/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/review/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/people/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/review/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/people/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/primer/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/review/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter02/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter03/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/runserver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python manage.py runserver 0.0.0.0:8000 4 | -------------------------------------------------------------------------------- /chapter02/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter02/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter03/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter03/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter03/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter03/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/people/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/people/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/review/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/people/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/review/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/people/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/review/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/people/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/review/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/home/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/home/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/people/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/primer/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/primer/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/review/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /data/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/data/logo.png -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/assets/logo.png -------------------------------------------------------------------------------- /chapter02/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter03/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter03/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter04/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter05/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter06/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter07/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter08/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter09/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /chapter10/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/home/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /chapter12/Alexandria/primer/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /data/Homer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/data/Homer.jpg -------------------------------------------------------------------------------- /data/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/data/favicon.ico -------------------------------------------------------------------------------- /assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/assets/favicon.ico -------------------------------------------------------------------------------- /data/Hemingway.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/data/Hemingway.jpg -------------------------------------------------------------------------------- /data/Conan_Doyle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/data/Conan_Doyle.jpg -------------------------------------------------------------------------------- /chapter03/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | python manage.py migrate 6 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Django==4.0.10 2 | django-debug-toolbar==3.2.4 3 | django-grappelli==3.0.2 4 | djangorestframework==3.13.1 5 | Pillow==9.3.0 6 | -------------------------------------------------------------------------------- /chapter03/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter03/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter04/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter04/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter05/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter05/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter06/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter06/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter07/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter07/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter08/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter08/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter09/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter09/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter10/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter10/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter12/Alexandria/static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter12/Alexandria/static/logo.png -------------------------------------------------------------------------------- /chapter03/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter03/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter04/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter04/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter05/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter05/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter06/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter06/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter07/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter07/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter08/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter08/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter09/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter09/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter10/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter10/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter12/Alexandria/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter12/Alexandria/static/favicon.ico -------------------------------------------------------------------------------- /chapter08/Alexandria/tests/data/Michael.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter08/Alexandria/tests/data/Michael.jpg -------------------------------------------------------------------------------- /chapter08/uploads/Alexandria/Hemingway.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter08/uploads/Alexandria/Hemingway.jpg -------------------------------------------------------------------------------- /chapter09/Alexandria/tests/data/Michael.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter09/Alexandria/tests/data/Michael.jpg -------------------------------------------------------------------------------- /chapter09/uploads/Alexandria/Hemingway.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter09/uploads/Alexandria/Hemingway.jpg -------------------------------------------------------------------------------- /chapter10/Alexandria/tests/data/Michael.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter10/Alexandria/tests/data/Michael.jpg -------------------------------------------------------------------------------- /chapter12/Alexandria/tests/data/Michael.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter12/Alexandria/tests/data/Michael.jpg -------------------------------------------------------------------------------- /chapter08/uploads/Alexandria/1_Conan_Doyle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter08/uploads/Alexandria/1_Conan_Doyle.jpg -------------------------------------------------------------------------------- /chapter09/uploads/Alexandria/1_Conan_Doyle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talkpython/getting-started-with-django-course/HEAD/chapter09/uploads/Alexandria/1_Conan_Doyle.jpg -------------------------------------------------------------------------------- /chapter03/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter10/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter12/Alexandria/home/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class HomeConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'home' 7 | -------------------------------------------------------------------------------- /chapter02/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter03/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter04/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter05/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter06/Alexandria/people/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PeopleConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'people' 7 | -------------------------------------------------------------------------------- /chapter06/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Your password was changed

5 | 6 | {% endblock content %} 7 | -------------------------------------------------------------------------------- /chapter07/Alexandria/people/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PeopleConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'people' 7 | -------------------------------------------------------------------------------- /chapter07/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter07/Alexandria/review/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ReviewConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'review' 7 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Your password was changed

5 | 6 | {% endblock content %} 7 | -------------------------------------------------------------------------------- /chapter08/Alexandria/people/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PeopleConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'people' 7 | -------------------------------------------------------------------------------- /chapter08/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter08/Alexandria/review/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ReviewConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'review' 7 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Your password was changed

5 | 6 | {% endblock content %} 7 | -------------------------------------------------------------------------------- /chapter09/Alexandria/people/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PeopleConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'people' 7 | -------------------------------------------------------------------------------- /chapter09/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter09/Alexandria/review/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ReviewConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'review' 7 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Your password was changed

5 | 6 | {% endblock content %} 7 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MusicConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'music' 7 | -------------------------------------------------------------------------------- /chapter10/Alexandria/people/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PeopleConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'people' 7 | -------------------------------------------------------------------------------- /chapter10/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter10/Alexandria/review/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ReviewConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'review' 7 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Your password was changed

5 | 6 | {% endblock content %} 7 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class MusicConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'music' 7 | -------------------------------------------------------------------------------- /chapter12/Alexandria/people/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PeopleConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'people' 7 | -------------------------------------------------------------------------------- /chapter12/Alexandria/primer/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PrimerConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'primer' 7 | -------------------------------------------------------------------------------- /chapter12/Alexandria/review/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ReviewConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'review' 7 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/registration/password_change_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Your password was changed

5 | 6 | {% endblock content %} 7 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter05/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter06/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter07/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter08/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CatalogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'catalog' 7 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter05/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter06/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter08/Alexandria/README_NOW_FIX_FIXTURE.txt: -------------------------------------------------------------------------------- 1 | Fixture is broken, this one is loading chapter 7, save a new one after 2 | recording the demo 3 | 4 | need to update resetdb.sh in Chapters 9+ after this one is fixed to load 5 | ch08.json 6 | -------------------------------------------------------------------------------- /chapter02/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter03/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter03/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter04/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter05/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter06/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter07/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter08/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter09/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter10/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter10/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter12/Alexandria/home/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/urls.py 2 | 3 | from django.urls import path 4 | 5 | from home import views 6 | 7 | urlpatterns = [ 8 | path('sample/', views.sample), 9 | path('about/', views.about), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter12/Alexandria/primer/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/primer/views.py 2 | 3 | from django.http import HttpResponse 4 | 5 | def say_hello(request): 6 | message = "Hello world!" 7 | 8 | return HttpResponse(message, content_type="text/plain") 9 | -------------------------------------------------------------------------------- /chapter07/Alexandria/review/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/urls.py 2 | 3 | from django.urls import path 4 | 5 | from review import views 6 | 7 | urlpatterns = [ 8 | path('review_book//', views.review_book, name="review_book"), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter08/Alexandria/review/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/urls.py 2 | 3 | from django.urls import path 4 | 5 | from review import views 6 | 7 | urlpatterns = [ 8 | path('review_book//', views.review_book, name="review_book"), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter09/Alexandria/review/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/urls.py 2 | 3 | from django.urls import path 4 | 5 | from review import views 6 | 7 | urlpatterns = [ 8 | path('review_book//', views.review_book, name="review_book"), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter10/Alexandria/review/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/urls.py 2 | 3 | from django.urls import path 4 | 5 | from review import views 6 | 7 | urlpatterns = [ 8 | path('review_book//', views.review_book, name="review_book"), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter12/Alexandria/review/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/urls.py 2 | 3 | from django.urls import path 4 | 5 | from review import views 6 | 7 | urlpatterns = [ 8 | path('review_book//', views.review_book, name="review_book"), 9 | ] 10 | -------------------------------------------------------------------------------- /chapter04/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations 6 | python manage.py makemigrations catalog 7 | python manage.py migrate 8 | python manage.py loaddata ../../data/ch04.json 9 | -------------------------------------------------------------------------------- /chapter05/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations 6 | python manage.py makemigrations catalog 7 | python manage.py migrate 8 | python manage.py loaddata ../../data/ch05.json 9 | -------------------------------------------------------------------------------- /chapter03/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 | {% endblock content %} 11 | -------------------------------------------------------------------------------- /chapter07/Alexandria/review/forms.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/forms.py 2 | from django.forms import ModelForm 3 | 4 | from review.models import Review 5 | 6 | class ReviewForm(ModelForm): 7 | class Meta: 8 | model = Review 9 | fields = ('rating', 'text') 10 | -------------------------------------------------------------------------------- /chapter08/Alexandria/review/forms.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/forms.py 2 | from django.forms import ModelForm 3 | 4 | from review.models import Review 5 | 6 | class ReviewForm(ModelForm): 7 | class Meta: 8 | model = Review 9 | fields = ('rating', 'text') 10 | -------------------------------------------------------------------------------- /chapter09/Alexandria/review/forms.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/forms.py 2 | from django.forms import ModelForm 3 | 4 | from review.models import Review 5 | 6 | class ReviewForm(ModelForm): 7 | class Meta: 8 | model = Review 9 | fields = ('rating', 'text') 10 | -------------------------------------------------------------------------------- /chapter10/Alexandria/review/forms.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/forms.py 2 | from django.forms import ModelForm 3 | 4 | from review.models import Review 5 | 6 | class ReviewForm(ModelForm): 7 | class Meta: 8 | model = Review 9 | fields = ('rating', 'text') 10 | -------------------------------------------------------------------------------- /chapter12/Alexandria/review/forms.py: -------------------------------------------------------------------------------- 1 | # Alexandria/review/forms.py 2 | from django.forms import ModelForm 3 | 4 | from review.models import Review 5 | 6 | class ReviewForm(ModelForm): 7 | class Meta: 8 | model = Review 9 | fields = ('rating', 'text') 10 | -------------------------------------------------------------------------------- /chapter06/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations people/migrations 6 | python manage.py makemigrations people catalog 7 | python manage.py migrate 8 | python manage.py loaddata ../../data/ch06.json 9 | -------------------------------------------------------------------------------- /chapter06/Alexandria/people/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/people/urls.py 2 | 3 | from django.urls import path 4 | 5 | from people import views 6 | 7 | urlpatterns = [ 8 | path('profile_listing/', views.profile_listing), 9 | path('profile//', views.profile), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter07/Alexandria/people/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/people/urls.py 2 | 3 | from django.urls import path 4 | 5 | from people import views 6 | 7 | urlpatterns = [ 8 | path('profile_listing/', views.profile_listing), 9 | path('profile//', views.profile), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter08/Alexandria/people/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/people/urls.py 2 | 3 | from django.urls import path 4 | 5 | from people import views 6 | 7 | urlpatterns = [ 8 | path('profile_listing/', views.profile_listing), 9 | path('profile//', views.profile), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter09/Alexandria/people/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/people/urls.py 2 | 3 | from django.urls import path 4 | 5 | from people import views 6 | 7 | urlpatterns = [ 8 | path('profile_listing/', views.profile_listing), 9 | path('profile//', views.profile), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter10/Alexandria/people/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/people/urls.py 2 | 3 | from django.urls import path 4 | 5 | from people import views 6 | 7 | urlpatterns = [ 8 | path('profile_listing/', views.profile_listing), 9 | path('profile//', views.profile), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter12/Alexandria/people/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/people/urls.py 2 | 3 | from django.urls import path 4 | 5 | from people import views 6 | 7 | urlpatterns = [ 8 | path('profile_listing/', views.profile_listing), 9 | path('profile//', views.profile), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter02/Alexandria/Alexandria/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/Alexandria/urls.py 2 | from django.contrib import admin 3 | from django.urls import path 4 | 5 | from primer.views import say_hello 6 | 7 | urlpatterns = [ 8 | path('admin/', admin.site.urls), 9 | 10 | path('say_hello/', say_hello), 11 | ] 12 | -------------------------------------------------------------------------------- /chapter07/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing, name="book_listing"), 9 | path('book//', views.book, name="book"), 10 | ] 11 | -------------------------------------------------------------------------------- /chapter07/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations people/migrations review/migrations 6 | python manage.py makemigrations people catalog review 7 | python manage.py migrate 8 | python manage.py loaddata ../../data/ch07.json 9 | -------------------------------------------------------------------------------- /chapter03/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter04/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter05/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/about.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - About {% endblock title %} 4 | 5 | {% block content %} 6 |

About

7 | 8 |

9 | Alexandria is both a digital library and a sample Django application 10 |

11 | {% endblock content %} 12 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/models.py: -------------------------------------------------------------------------------- 1 | # Alexandria/music/models.py 2 | from django.db import models 3 | 4 | class Song(models.Model): 5 | title = models.CharField(max_length=50) 6 | artist_name = models.CharField(max_length=50) 7 | 8 | def __str__(self): 9 | return f"Song(id={self.id}, title={self.title})" 10 | -------------------------------------------------------------------------------- /chapter02/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | #rm -rf ../outside/Vye/account_uploads 6 | #rm -rf ../outside/Vye/thumbnails 7 | rm -rf catalog/migrations 8 | 9 | # django db and test data process 10 | python manage.py makemigrations catalog 11 | python manage.py migrate 12 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

User: {{profile.username}}

5 | 6 |

7 | ID: {{profile.id}}
8 | First name: {{profile.first_name}}
9 | Last name: {{profile.last_name}}
10 |

11 | 12 | {% endblock content %} 13 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

User: {{profile.username}}

5 | 6 |

7 | ID: {{profile.id}}
8 | First name: {{profile.first_name}}
9 | Last name: {{profile.last_name}}
10 |

11 | 12 | {% endblock content %} 13 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

User: {{profile.username}}

5 | 6 |

7 | ID: {{profile.id}}
8 | First name: {{profile.first_name}}
9 | Last name: {{profile.last_name}}
10 |

11 | 12 | {% endblock content %} 13 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

User: {{profile.username}}

5 | 6 |

7 | ID: {{profile.id}}
8 | First name: {{profile.first_name}}
9 | Last name: {{profile.last_name}}
10 |

11 | 12 | {% endblock content %} 13 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

User: {{profile.username}}

5 | 6 |

7 | ID: {{profile.id}}
8 | First name: {{profile.first_name}}
9 | Last name: {{profile.last_name}}
10 |

11 | 12 | {% endblock content %} 13 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/profile.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

User: {{profile.username}}

5 | 6 |

7 | ID: {{profile.id}}
8 | First name: {{profile.first_name}}
9 | Last name: {{profile.last_name}}
10 |

11 | 12 | {% endblock content %} 13 | -------------------------------------------------------------------------------- /chapter02/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/test/test_primer.py 2 | from django.test import TestCase 3 | 4 | class PrimerTestCase(TestCase): 5 | def test_say_hello(self): 6 | response = self.client.get('/say_hello/') 7 | self.assertEqual(200, response.status_code) 8 | self.assertIn("Hello", str(response.content)) 9 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/serializers.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/serializers.py 2 | from rest_framework import serializers 3 | 4 | from catalog.models import Author 5 | 6 | class AuthorSerializer(serializers.ModelSerializer): 7 | class Meta: 8 | model = Author 9 | fields = ["id", "first_name", "last_name", "birth_year"] 10 | -------------------------------------------------------------------------------- /chapter04/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |

13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter05/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |

13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |

13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |

13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | from catalog.models import Book 6 | 7 | def book_listing(request): 8 | data = { 9 | 'books':Book.objects.order_by('author__last_name', 'title'), 10 | } 11 | 12 | return render(request, 'book_listing.html', data) 13 | -------------------------------------------------------------------------------- /chapter05/Alexandria/catalog/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | from catalog.models import Book 6 | 7 | def book_listing(request): 8 | data = { 9 | 'books':Book.objects.order_by('author__last_name', 'title'), 10 | } 11 | 12 | return render(request, 'book_listing.html', data) 13 | -------------------------------------------------------------------------------- /chapter06/Alexandria/catalog/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | from catalog.models import Book 6 | 7 | def book_listing(request): 8 | data = { 9 | 'books':Book.objects.order_by('author__last_name', 'title'), 10 | } 11 | 12 | return render(request, 'book_listing.html', data) 13 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/models.py: -------------------------------------------------------------------------------- 1 | # Alexandria/music/models.py 2 | from django.db import models 3 | 4 | class Song(models.Model): 5 | title = models.CharField(max_length=50) 6 | 7 | # uncomment during Chapter 10 8 | # artist_name = models.CharField(max_length=50) 9 | 10 | def __str__(self): 11 | return f"Song(id={self.id}, title={self.title})" 12 | -------------------------------------------------------------------------------- /chapter03/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/test/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter04/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/test/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter05/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/test/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

Your password has been set

8 | 9 |

Login

10 | 11 |
12 |
13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter06/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

Your password has been set

8 | 9 |

Login

10 | 11 |
12 |
13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter07/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

Your password has been set

8 | 9 |

Login

10 | 11 |
12 |
13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter08/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

Your password has been set

8 | 9 |

Login

10 | 11 |
12 |
13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter09/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

Your password has been set

8 | 9 |

Login

10 | 11 |
12 |
13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter10/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/registration/password_reset_complete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

Your password has been set

8 | 9 |

Login

10 | 11 |
12 |
13 | {% endblock content %} 14 | -------------------------------------------------------------------------------- /chapter12/Alexandria/tests/test_primer.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_primer.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class PrimerTestCase(TestCase): 6 | def test_say_hello(self): 7 | response = self.client.get('/say_hello/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("Hello", str(response.content)) 10 | -------------------------------------------------------------------------------- /chapter02/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter03/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter04/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter05/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter06/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter07/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter08/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter09/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter10/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter12/Alexandria/credits.md: -------------------------------------------------------------------------------- 1 | Source Credits 2 | ============== 3 | 4 | This course uses a variety of images and data that are publicly available: 5 | 6 | * `static/logo.png` 7 | * Original work by "libberry" on [Open Clip Art](https://openclipart.org/detail/173650/library-pictogram) 8 | * `static/favicon.bmp` 9 | * Built using original work by "libberry" (see above) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/profile_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Book Lovers

5 | 6 |
    7 | {% for profile in profiles %} 8 |
  • 9 | {{profile.username}} 10 |
  • 11 | 12 | {% empty %} 13 | No book lovers yet! 14 | {% endfor %} 15 | 16 |
17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/profile_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Book Lovers

5 | 6 |
    7 | {% for profile in profiles %} 8 |
  • 9 | {{profile.username}} 10 |
  • 11 | 12 | {% empty %} 13 | No book lovers yet! 14 | {% endfor %} 15 | 16 |
17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/profile_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Book Lovers

5 | 6 |
    7 | {% for profile in profiles %} 8 |
  • 9 | {{profile.username}} 10 |
  • 11 | 12 | {% empty %} 13 | No book lovers yet! 14 | {% endfor %} 15 | 16 |
17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/profile_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Book Lovers

5 | 6 |
    7 | {% for profile in profiles %} 8 |
  • 9 | {{profile.username}} 10 |
  • 11 | 12 | {% empty %} 13 | No book lovers yet! 14 | {% endfor %} 15 | 16 |
17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/profile_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Book Lovers

5 | 6 |
    7 | {% for profile in profiles %} 8 |
  • 9 | {{profile.username}} 10 |
  • 11 | 12 | {% empty %} 13 | No book lovers yet! 14 | {% endfor %} 15 | 16 |
17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/profile_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Book Lovers

5 | 6 |
    7 | {% for profile in profiles %} 8 |
  • 9 | {{profile.username}} 10 |
  • 11 | 12 | {% empty %} 13 | No book lovers yet! 14 | {% endfor %} 15 | 16 |
17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter03/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter04/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter05/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |   13 | View Authors 14 |

15 | {% endblock content %} 16 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |   13 | View Authors 14 |

15 | {% endblock content %} 16 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |   13 | View Authors 14 |

15 | {% endblock content %} 16 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Alexandria

5 | 6 |

7 | Welcome to Alexandria! This is a sample site for the "Getting Started with 8 | Django" Course. 9 |

10 |

11 | View Books 12 |   13 | View Authors 14 |

15 | {% endblock content %} 16 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - Page Not Found {% endblock title %} 4 | 5 | {% block content %} 6 |

Page Not Found

7 | 8 |

9 | 10 | The pages are still blank,
11 | But there is a miraculous feeling of the words being there,
12 | Written in invisible ink
13 | and clamoring to become visible. 14 |
15 | 16 | -- V. Nabokov 17 |

18 | {% endblock content %} 19 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - Page Not Found {% endblock title %} 4 | 5 | {% block content %} 6 |

Page Not Found

7 | 8 |

9 | 10 | The pages are still blank,
11 | But there is a miraculous feeling of the words being there,
12 | Written in invisible ink
13 | and clamoring to become visible. 14 |
15 | 16 | -- V. Nabokov 17 |

18 | {% endblock content %} 19 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - Page Not Found {% endblock title %} 4 | 5 | {% block content %} 6 |

Page Not Found

7 | 8 |

9 | 10 | The pages are still blank,
11 | But there is a miraculous feeling of the words being there,
12 | Written in invisible ink
13 | and clamoring to become visible. 14 |
15 | 16 | -- V. Nabokov 17 |

18 | {% endblock content %} 19 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - Page Not Found {% endblock title %} 4 | 5 | {% block content %} 6 |

Page Not Found

7 | 8 |

9 | 10 | The pages are still blank,
11 | But there is a miraculous feeling of the words being there,
12 | Written in invisible ink
13 | and clamoring to become visible. 14 |
15 | 16 | -- V. Nabokov 17 |

18 | {% endblock content %} 19 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - Page Not Found {% endblock title %} 4 | 5 | {% block content %} 6 |

Page Not Found

7 | 8 |

9 | 10 | The pages are still blank,
11 | But there is a miraculous feeling of the words being there,
12 | Written in invisible ink
13 | and clamoring to become visible. 14 |
15 | 16 | -- V. Nabokov 17 |

18 | {% endblock content %} 19 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block title %}Alexandria - Page Not Found {% endblock title %} 4 | 5 | {% block content %} 6 |

Page Not Found

7 | 8 |

9 | 10 | The pages are still blank,
11 | But there is a miraculous feeling of the words being there,
12 | Written in invisible ink
13 | and clamoring to become visible. 14 |
15 | 16 | -- V. Nabokov 17 |

18 | {% endblock content %} 19 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/author_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Authors

5 | 6 |

7 | {% for author in authors %} 8 | {{author.last_name}}{% if author.first_name %}, {{author.first_name}}{% endif %} 10 |
11 | 12 | {% empty %} 13 | There were no authors 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/author_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Authors

5 | 6 |

7 | {% for author in authors %} 8 | {{author.last_name}}{% if author.first_name %}, {{author.first_name}}{% endif %} 10 |
11 | 12 | {% empty %} 13 | There were no authors 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/author_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Authors

5 | 6 |

7 | {% for author in authors %} 8 | {{author.last_name}}{% if author.first_name %}, {{author.first_name}}{% endif %} 10 |
11 | 12 | {% empty %} 13 | There were no authors 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/author_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Authors

5 | 6 |

7 | {% for author in authors %} 8 | {{author.last_name}}{% if author.first_name %}, {{author.first_name}}{% endif %} 10 |
11 | 12 | {% empty %} 13 | There were no authors 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/book_listing.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Books

5 | 6 |

7 | {% for book in books %} 8 | {{book.title}}; 9 | {{book.author.last_name}}{% if book.author.first_name %}, {{book.author.first_name}}{% endif %}. 10 |
11 | 12 | {% empty %} 13 | There were no books 14 | {% endfor %} 15 | 16 |

17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter02/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter02/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter03/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter03/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter04/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter04/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter05/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter05/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter06/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter06/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter07/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter07/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter08/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter08/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter09/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter09/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter10/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter10/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter12/Alexandria/Alexandria/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Alexandria 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.2/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', 'Alexandria.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /chapter12/Alexandria/Alexandria/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Alexandria 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.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', 'Alexandria.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /chapter03/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter04/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter05/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/sample.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

{{heading}}

4 | 5 |

6 | Welcome to the Alexandria sample page. Here are some books: 7 | 8 |

    9 | {% for book in books %} 10 |
  • 11 | {{book.title|upper}}, 12 | {{book.author}} 13 | {% if book.recommended %} 14 | !!! 15 | {% endif %} 16 |
  • 17 | {% endfor %} 18 |
19 |

20 | 21 | 22 | -------------------------------------------------------------------------------- /chapter07/Alexandria/catalog/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/views.py 2 | from django.shortcuts import render, get_object_or_404 3 | 4 | from catalog.models import Book 5 | 6 | def book_listing(request): 7 | data = { 8 | 'books':Book.objects.order_by('author__last_name', 'title'), 9 | } 10 | 11 | return render(request, 'book_listing.html', data) 12 | 13 | def book(request, book_id): 14 | book = get_object_or_404(Book, id=book_id) 15 | return render(request, 'book.html', {'book':book}) 16 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/pages.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - {{book.title}}{% endblock %} 3 | 4 | {% block content %} 5 |

{{book.title}}

6 |

By {{book.author.first_name}} {{book.author.last_name}}

7 | 8 |

{{pages.text|linebreaksbr}}

9 | 10 |
11 |
12 | Review Book 14 | View Details 16 | 17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/pages.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - {{book.title}}{% endblock %} 3 | 4 | {% block content %} 5 |

{{book.title}}

6 |

By {{book.author.first_name}} {{book.author.last_name}}

7 | 8 |

{{pages.text|linebreaksbr}}

9 | 10 |
11 |
12 | Review Book 14 | View Details 16 | 17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/pages.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - {{book.title}}{% endblock %} 3 | 4 | {% block content %} 5 |

{{book.title}}

6 |

By {{book.author.first_name}} {{book.author.last_name}}

7 | 8 |

{{pages.text|linebreaksbr}}

9 | 10 |
11 |
12 | Review Book 14 | View Details 16 | 17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/pages.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - {{book.title}}{% endblock %} 3 | 4 | {% block content %} 5 |

{{book.title}}

6 |

By {{book.author.first_name}} {{book.author.last_name}}

7 | 8 |

{{pages.text|linebreaksbr}}

9 | 10 |
11 |
12 | Review Book 14 | View Details 16 | 17 | {% endblock content %} 18 | -------------------------------------------------------------------------------- /chapter09/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations people/migrations review/migrations 6 | 7 | rm ../uploads/Alexandria/* 8 | cp ../../data/Conan_Doyle.jpg ../uploads/Alexandria/1_Conan_Doyle.jpg 9 | cp ../../data/Hemingway.jpg ../uploads/Alexandria/Hemingway.jpg 10 | 11 | # django db and test data process 12 | python manage.py makemigrations people catalog review 13 | python manage.py migrate 14 | 15 | python manage.py loaddata ../../data/ch08.json 16 | -------------------------------------------------------------------------------- /chapter03/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter04/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter05/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter06/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter07/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter08/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter09/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter10/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter12/Alexandria/static/css/site.css: -------------------------------------------------------------------------------- 1 | main { 2 | min-height: 87vh; 3 | } 4 | 5 | body, footer { 6 | background-color: #fff; 7 | } 8 | 9 | .info-text { 10 | color:#aaa; 11 | } 12 | 13 | footer { 14 | background-color: #343a40; 15 | padding: 25px; 16 | color: #aaa; 17 | text-align: center; 18 | } 19 | 20 | footer a { 21 | color: white; 22 | } 23 | 24 | footer a:hover { 25 | color: white; 26 | text-decoration: underline; 27 | } 28 | 29 | .logo-img { 30 | height:40px; 31 | width:auto; 32 | } 33 | -------------------------------------------------------------------------------- /chapter08/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations people/migrations review/migrations 6 | 7 | rm ../uploads/Alexandria/* 8 | cp ../../data/Conan_Doyle.jpg ../uploads/Alexandria/1_Conan_Doyle.jpg 9 | cp ../../data/Hemingway.jpg ../uploads/Alexandria/Hemingway.jpg 10 | 11 | python manage.py makemigrations people catalog review 12 | python manage.py migrate 13 | 14 | #python manage.py loaddata ../../data/ch08.json 15 | python manage.py loaddata ../../data/ch07.json 16 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Login

5 | 6 |
7 | {% csrf_token %} 8 | {{form.as_p}} 9 | 10 |
11 | 12 | {% comment "Uncomment in Chapter 5 after creating password change" %} 13 | {% endcomment %} 14 | 15 |
16 |

17 | Lost password? 18 |

19 | 20 | {% comment %} 21 | {% endcomment %} 22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Login

5 | 6 |
7 | {% csrf_token %} 8 | {{form.as_p}} 9 | 10 |
11 | 12 | {% comment "Uncomment in Chapter 5 after creating password change" %} 13 | {% endcomment %} 14 | 15 |
16 |

17 | Lost password? 18 |

19 | 20 | {% comment %} 21 | {% endcomment %} 22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Login

5 | 6 |
7 | {% csrf_token %} 8 | {{form.as_p}} 9 | 10 |
11 | 12 | {% comment "Uncomment in Chapter 5 after creating password change" %} 13 | {% endcomment %} 14 | 15 |
16 |

17 | Lost password? 18 |

19 | 20 | {% comment %} 21 | {% endcomment %} 22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Login

5 | 6 |
7 | {% csrf_token %} 8 | {{form.as_p}} 9 | 10 |
11 | 12 | {% comment "Uncomment in Chapter 5 after creating password change" %} 13 | {% endcomment %} 14 | 15 |
16 |

17 | Lost password? 18 |

19 | 20 | {% comment %} 21 | {% endcomment %} 22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Login

5 | 6 |
7 | {% csrf_token %} 8 | {{form.as_p}} 9 | 10 |
11 | 12 | {% comment "Uncomment in Chapter 5 after creating password change" %} 13 | {% endcomment %} 14 | 15 |
16 |

17 | Lost password? 18 |

19 | 20 | {% comment %} 21 | {% endcomment %} 22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/registration/login.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |

Login

5 | 6 |
7 | {% csrf_token %} 8 | {{form.as_p}} 9 | 10 |
11 | 12 | {% comment "Uncomment in Chapter 5 after creating password change" %} 13 | {% endcomment %} 14 | 15 |
16 |

17 | Lost password? 18 |

19 | 20 | {% comment %} 21 | {% endcomment %} 22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter03/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/test/test_home.py 2 | from django.test import TestCase 3 | 4 | class HomeTestCase(TestCase): 5 | def test_home(self): 6 | response = self.client.get('/home/sample/') 7 | self.assertEqual(200, response.status_code) 8 | self.assertIn("books", response.context) 9 | 10 | response = self.client.get('/home/about/') 11 | self.assertEqual(200, response.status_code) 12 | 13 | response = self.client.get('/') 14 | self.assertEqual(200, response.status_code) 15 | -------------------------------------------------------------------------------- /chapter10/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations people/migrations review/migrations shelf/migrations 6 | 7 | rm ../uploads/Alexandria/* 8 | cp ../../data/Conan_Doyle.jpg ../uploads/Alexandria/1_Conan_Doyle.jpg 9 | cp ../../data/Hemingway.jpg ../uploads/Alexandria/Hemingway.jpg 10 | 11 | # django db and test data process 12 | python manage.py makemigrations people catalog review shelf 13 | python manage.py migrate 14 | 15 | python manage.py loaddata ../../data/ch07.json 16 | -------------------------------------------------------------------------------- /chapter12/Alexandria/resetdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | find . -name "*.pyc" -exec rm {} \; 4 | rm db.sqlite3 5 | rm -rf catalog/migrations people/migrations review/migrations shelf/migrations 6 | 7 | rm ../uploads/Alexandria/* 8 | cp ../../data/Conan_Doyle.jpg ../uploads/Alexandria/1_Conan_Doyle.jpg 9 | cp ../../data/Hemingway.jpg ../uploads/Alexandria/Hemingway.jpg 10 | 11 | # django db and test data process 12 | python manage.py makemigrations people catalog review shelf 13 | python manage.py migrate 14 | 15 | python manage.py loaddata ../../data/ch07.json 16 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/migrations/0002_song_artist_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.7 on 2021-11-30 18:44 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('music', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='song', 15 | name='artist_name', 16 | field=models.CharField(default='unknown', max_length=50), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/migrations/0002_song_artist_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.7 on 2021-11-30 18:44 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('music', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='song', 15 | name='artist_name', 16 | field=models.CharField(default='unknown', max_length=50), 17 | preserve_default=False, 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /chapter06/Alexandria/tests/test_people.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_people.py 2 | from django.contrib.auth.models import User 3 | from django.test import TestCase, Client 4 | 5 | class PeopleTestCase(TestCase): 6 | def test_reader_signal(self): 7 | user = User.objects.create(username="foo", password="asdfasdf33") 8 | self.assertIsNotNone(user.reader) 9 | 10 | def test_404(self): 11 | response = self.client.get('/not_a_valid_url/') 12 | expected = 'The pages are still blank,' 13 | self.assertIn(expected, str(response.content)) 14 | -------------------------------------------------------------------------------- /chapter07/Alexandria/tests/test_people.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_people.py 2 | from django.contrib.auth.models import User 3 | from django.test import TestCase, Client 4 | 5 | class PeopleTestCase(TestCase): 6 | def test_reader_signal(self): 7 | user = User.objects.create(username="foo", password="asdfasdf33") 8 | self.assertIsNotNone(user.reader) 9 | 10 | def test_404(self): 11 | response = self.client.get('/not_a_valid_url/') 12 | expected = 'The pages are still blank,' 13 | self.assertIn(expected, str(response.content)) 14 | -------------------------------------------------------------------------------- /chapter08/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing, name="book_listing"), 9 | path('book//', views.book, name="book"), 10 | path('author_listing/', views.author_listing, name="author_listing"), 11 | path('author//', views.author, name="author"), 12 | path('upload_author_photo//', views.upload_author_photo, 13 | name="upload_author_photo"), 14 | ] 15 | -------------------------------------------------------------------------------- /chapter08/Alexandria/tests/test_people.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_people.py 2 | from django.contrib.auth.models import User 3 | from django.test import TestCase, Client 4 | 5 | class PeopleTestCase(TestCase): 6 | def test_reader_signal(self): 7 | user = User.objects.create(username="foo", password="asdfasdf33") 8 | self.assertIsNotNone(user.reader) 9 | 10 | def test_404(self): 11 | response = self.client.get('/not_a_valid_url/') 12 | expected = 'The pages are still blank,' 13 | self.assertIn(expected, str(response.content)) 14 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing, name="book_listing"), 9 | path('book//', views.book, name="book"), 10 | path('author_listing/', views.author_listing, name="author_listing"), 11 | path('author//', views.author, name="author"), 12 | path('upload_author_photo//', views.upload_author_photo, 13 | name="upload_author_photo"), 14 | ] 15 | -------------------------------------------------------------------------------- /chapter09/Alexandria/tests/test_people.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_people.py 2 | from django.contrib.auth.models import User 3 | from django.test import TestCase, Client 4 | 5 | class PeopleTestCase(TestCase): 6 | def test_reader_signal(self): 7 | user = User.objects.create(username="foo", password="asdfasdf33") 8 | self.assertIsNotNone(user.reader) 9 | 10 | def test_404(self): 11 | response = self.client.get('/not_a_valid_url/') 12 | expected = 'The pages are still blank,' 13 | self.assertIn(expected, str(response.content)) 14 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing, name="book_listing"), 9 | path('book//', views.book, name="book"), 10 | path('author_listing/', views.author_listing, name="author_listing"), 11 | path('author//', views.author, name="author"), 12 | path('upload_author_photo//', views.upload_author_photo, 13 | name="upload_author_photo"), 14 | ] 15 | -------------------------------------------------------------------------------- /chapter10/Alexandria/tests/test_people.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_people.py 2 | from django.contrib.auth.models import User 3 | from django.test import TestCase, Client 4 | 5 | class PeopleTestCase(TestCase): 6 | def test_reader_signal(self): 7 | user = User.objects.create(username="foo", password="asdfasdf33") 8 | self.assertIsNotNone(user.reader) 9 | 10 | def test_404(self): 11 | response = self.client.get('/not_a_valid_url/') 12 | expected = 'The pages are still blank,' 13 | self.assertIn(expected, str(response.content)) 14 | -------------------------------------------------------------------------------- /chapter12/Alexandria/tests/test_people.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_people.py 2 | from django.contrib.auth.models import User 3 | from django.test import TestCase, Client 4 | 5 | class PeopleTestCase(TestCase): 6 | def test_reader_signal(self): 7 | user = User.objects.create(username="foo", password="asdfasdf33") 8 | self.assertIsNotNone(user.reader) 9 | 10 | def test_404(self): 11 | response = self.client.get('/not_a_valid_url/') 12 | expected = 'The pages are still blank,' 13 | self.assertIn(expected, str(response.content)) 14 | -------------------------------------------------------------------------------- /chapter03/Alexandria/Alexandria/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/Alexandria/urls.py 2 | 3 | from django.contrib import admin 4 | from django.urls import path, include 5 | from django.views.generic.base import RedirectView 6 | 7 | from primer.views import say_hello 8 | from home import views as home_views 9 | 10 | urlpatterns = [ 11 | path('favicon.ico', RedirectView.as_view(url='/static/favicon.ico')), 12 | 13 | path('admin/', admin.site.urls), 14 | 15 | path('say_hello/', say_hello), 16 | path('home/', include('home.urls')), 17 | path('', home_views.home), 18 | ] 19 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | 3 | You're receiving this email because you requested a password reset for your 4 | user account at Alexandria. 5 | 6 | Please go to the following page and choose a new password: 7 | 8 | {% block reset_link %} 9 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 10 | {% endblock %} 11 | 12 | Your username, in case you've forgotten: {{ user.get_username }} 13 | 14 | Thanks for using our site! 15 | 16 | {% endautoescape %} 17 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | 3 | You're receiving this email because you requested a password reset for your 4 | user account at Alexandria. 5 | 6 | Please go to the following page and choose a new password: 7 | 8 | {% block reset_link %} 9 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 10 | {% endblock %} 11 | 12 | Your username, in case you've forgotten: {{ user.get_username }} 13 | 14 | Thanks for using our site! 15 | 16 | {% endautoescape %} 17 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | 3 | You're receiving this email because you requested a password reset for your 4 | user account at Alexandria. 5 | 6 | Please go to the following page and choose a new password: 7 | 8 | {% block reset_link %} 9 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 10 | {% endblock %} 11 | 12 | Your username, in case you've forgotten: {{ user.get_username }} 13 | 14 | Thanks for using our site! 15 | 16 | {% endautoescape %} 17 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | 3 | You're receiving this email because you requested a password reset for your 4 | user account at Alexandria. 5 | 6 | Please go to the following page and choose a new password: 7 | 8 | {% block reset_link %} 9 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 10 | {% endblock %} 11 | 12 | Your username, in case you've forgotten: {{ user.get_username }} 13 | 14 | Thanks for using our site! 15 | 16 | {% endautoescape %} 17 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | 3 | You're receiving this email because you requested a password reset for your 4 | user account at Alexandria. 5 | 6 | Please go to the following page and choose a new password: 7 | 8 | {% block reset_link %} 9 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 10 | {% endblock %} 11 | 12 | Your username, in case you've forgotten: {{ user.get_username }} 13 | 14 | Thanks for using our site! 15 | 16 | {% endautoescape %} 17 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/registration/password_reset_email.html: -------------------------------------------------------------------------------- 1 | {% autoescape off %} 2 | 3 | You're receiving this email because you requested a password reset for your 4 | user account at Alexandria. 5 | 6 | Please go to the following page and choose a new password: 7 | 8 | {% block reset_link %} 9 | {{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %} 10 | {% endblock %} 11 | 12 | Your username, in case you've forgotten: {{ user.get_username }} 13 | 14 | Thanks for using our site! 15 | 16 | {% endautoescape %} 17 | -------------------------------------------------------------------------------- /chapter04/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/test/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /chapter05/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/test/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /chapter06/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /chapter07/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /chapter08/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /chapter09/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /chapter10/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /chapter12/Alexandria/tests/test_home.py: -------------------------------------------------------------------------------- 1 | # Alexandria/tests/test_home.py 2 | from django.test import TestCase 3 | from django.test import Client 4 | 5 | class HomeTestCase(TestCase): 6 | def test_home(self): 7 | response = self.client.get('/home/sample/') 8 | self.assertEqual(200, response.status_code) 9 | self.assertIn("books", response.context) 10 | 11 | response = self.client.get('/home/about/') 12 | self.assertEqual(200, response.status_code) 13 | 14 | response = self.client.get('/') 15 | self.assertEqual(200, response.status_code) 16 | -------------------------------------------------------------------------------- /data/ch04.json: -------------------------------------------------------------------------------- 1 | [{"model": "catalog.author", "pk": 1, "fields": {"last_name": "Dickens", "first_name": "Charles", "birth_year": 1812}}, {"model": "catalog.book", "pk": 1, "fields": {"title": "A Tale of Two Cities", "author": 1, "created": "2021-10-12T17:57:42.409Z", "updated": "2021-10-12T17:57:42.409Z"}}, {"model": "catalog.book", "pk": 2, "fields": {"title": "Oliver Twist", "author": 1, "created": "2021-10-12T17:57:47.682Z", "updated": "2021-10-12T17:57:47.682Z"}}, {"model": "catalog.book", "pk": 3, "fields": {"title": "Hard Times", "author": 1, "created": "2021-10-12T17:57:53.218Z", "updated": "2021-10-12T17:57:53.218Z"}}] -------------------------------------------------------------------------------- /chapter10/Alexandria/music/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.7 on 2021-11-30 18:41 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='Song', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=50)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.7 on 2021-11-30 18:41 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='Song', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=50)), 19 | ], 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /chapter04/Alexandria/Alexandria/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/Alexandria/urls.py 2 | 3 | from django.contrib import admin 4 | from django.urls import path, include 5 | from django.views.generic.base import RedirectView 6 | 7 | from primer.views import say_hello 8 | from home import views as home_views 9 | 10 | urlpatterns = [ 11 | path('favicon.ico', RedirectView.as_view(url='/static/favicon.ico')), 12 | 13 | path('admin/', admin.site.urls), 14 | 15 | path('say_hello/', say_hello), 16 | path('home/', include('home.urls')), 17 | path('', home_views.home), 18 | path('catalog/', include('catalog.urls')), 19 | ] 20 | -------------------------------------------------------------------------------- /chapter05/Alexandria/Alexandria/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/Alexandria/urls.py 2 | 3 | from django.contrib import admin 4 | from django.urls import path, include 5 | from django.views.generic.base import RedirectView 6 | 7 | from primer.views import say_hello 8 | from home import views as home_views 9 | 10 | urlpatterns = [ 11 | path('favicon.ico', RedirectView.as_view(url='/static/favicon.ico')), 12 | 13 | path('admin/', admin.site.urls), 14 | 15 | path('say_hello/', say_hello), 16 | path('home/', include('home.urls')), 17 | path('', home_views.home), 18 | path('catalog/', include('catalog.urls')), 19 | ] 20 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/urls.py 2 | 3 | from django.urls import path 4 | 5 | from catalog import views 6 | 7 | urlpatterns = [ 8 | path('book_listing/', views.book_listing, name="book_listing"), 9 | path('book//', views.book, name="book"), 10 | path('author_listing/', views.author_listing, name="author_listing"), 11 | path('author//', views.author, name="author"), 12 | path('upload_author_photo//', views.upload_author_photo, 13 | name="upload_author_photo"), 14 | 15 | path('list_authors_api/', views.list_authors_api), 16 | ] 17 | -------------------------------------------------------------------------------- /chapter06/Alexandria/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

8 | We've emailed you instructions for setting your password, if an account 9 | exists with the email you entered. You should receive them shortly. 10 | 11 |

12 | 13 |

14 | If you don't receive an email, please make sure you've entered the address 15 | you registered with and check your spam folder. 16 | 17 |

18 | 19 |
20 |
21 | {% endblock content %} 22 | -------------------------------------------------------------------------------- /chapter07/Alexandria/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

8 | We've emailed you instructions for setting your password, if an account 9 | exists with the email you entered. You should receive them shortly. 10 | 11 |

12 | 13 |

14 | If you don't receive an email, please make sure you've entered the address 15 | you registered with and check your spam folder. 16 | 17 |

18 | 19 |
20 |
21 | {% endblock content %} 22 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

8 | We've emailed you instructions for setting your password, if an account 9 | exists with the email you entered. You should receive them shortly. 10 | 11 |

12 | 13 |

14 | If you don't receive an email, please make sure you've entered the address 15 | you registered with and check your spam folder. 16 | 17 |

18 | 19 |
20 |
21 | {% endblock content %} 22 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

8 | We've emailed you instructions for setting your password, if an account 9 | exists with the email you entered. You should receive them shortly. 10 | 11 |

12 | 13 |

14 | If you don't receive an email, please make sure you've entered the address 15 | you registered with and check your spam folder. 16 | 17 |

18 | 19 |
20 |
21 | {% endblock content %} 22 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

8 | We've emailed you instructions for setting your password, if an account 9 | exists with the email you entered. You should receive them shortly. 10 | 11 |

12 | 13 |

14 | If you don't receive an email, please make sure you've entered the address 15 | you registered with and check your spam folder. 16 | 17 |

18 | 19 |
20 |
21 | {% endblock content %} 22 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/registration/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% block content %} 4 |
5 |
6 | 7 |

8 | We've emailed you instructions for setting your password, if an account 9 | exists with the email you entered. You should receive them shortly. 10 | 11 |

12 | 13 |

14 | If you don't receive an email, please make sure you've entered the address 15 | you registered with and check your spam folder. 16 | 17 |

18 | 19 |
20 |
21 | {% endblock content %} 22 | -------------------------------------------------------------------------------- /chapter06/Alexandria/Alexandria/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/Alexandria/urls.py 2 | 3 | from django.contrib import admin 4 | from django.urls import path, include 5 | from django.views.generic.base import RedirectView 6 | 7 | from primer.views import say_hello 8 | from home import views as home_views 9 | 10 | urlpatterns = [ 11 | path('favicon.ico', RedirectView.as_view(url='/static/favicon.ico')), 12 | 13 | path('admin/', admin.site.urls), 14 | path('accounts/', include('django.contrib.auth.urls')), 15 | 16 | path('say_hello/', say_hello), 17 | path('home/', include('home.urls')), 18 | path('', home_views.home), 19 | path('catalog/', include('catalog.urls')), 20 | path('people/', include('people.urls')), 21 | ] 22 | -------------------------------------------------------------------------------- /chapter04/Alexandria/catalog/models.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/models.py 2 | 3 | from django.db import models 4 | 5 | class Author(models.Model): 6 | last_name = models.CharField(max_length=50) 7 | first_name = models.CharField(max_length=50, blank=True) 8 | birth_year = models.IntegerField() 9 | 10 | class Book(models.Model): 11 | title = models.TextField() 12 | author = models.ForeignKey(Author, on_delete=models.CASCADE, blank=True, 13 | null=True) 14 | created = models.DateTimeField(auto_now_add=True) 15 | updated = models.DateTimeField(auto_now=True) 16 | 17 | ### Uncommented in chapter 4 { 18 | # def __str__(self): 19 | # return f"Book(id={self.id}, title={self.title}, author_id={self.author.id})" 20 | ### } 21 | -------------------------------------------------------------------------------- /chapter02/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter03/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter04/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter05/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter06/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter07/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter08/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter08/Alexandria/templates/upload_author_photo.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - Upload {{author.last_name}} Photo{% endblock %} 3 | 4 | {% block content %} 5 |

Upload Photo for {{author.last_name}}

6 | 7 | {% if form.errors %} 8 |
Correct any errors before continuing.
9 | {% endif %} 10 | 11 |
12 | {% csrf_token %} 13 | 14 |
15 | 16 | 18 |
19 | 20 | 21 |
22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter09/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter09/Alexandria/templates/upload_author_photo.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - Upload {{author.last_name}} Photo{% endblock %} 3 | 4 | {% block content %} 5 |

Upload Photo for {{author.last_name}}

6 | 7 | {% if form.errors %} 8 |
Correct any errors before continuing.
9 | {% endif %} 10 | 11 |
12 | {% csrf_token %} 13 | 14 |
15 | 16 | 18 |
19 | 20 | 21 |
22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter10/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter10/Alexandria/templates/upload_author_photo.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - Upload {{author.last_name}} Photo{% endblock %} 3 | 4 | {% block content %} 5 |

Upload Photo for {{author.last_name}}

6 | 7 | {% if form.errors %} 8 |
Correct any errors before continuing.
9 | {% endif %} 10 | 11 |
12 | {% csrf_token %} 13 | 14 |
15 | 16 | 18 |
19 | 20 | 21 |
22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter12/Alexandria/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', 'Alexandria.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 | -------------------------------------------------------------------------------- /chapter12/Alexandria/templates/upload_author_photo.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | {% block title %}Alexandria - Upload {{author.last_name}} Photo{% endblock %} 3 | 4 | {% block content %} 5 |

Upload Photo for {{author.last_name}}

6 | 7 | {% if form.errors %} 8 |
Correct any errors before continuing.
9 | {% endif %} 10 | 11 |
12 | {% csrf_token %} 13 | 14 |
15 | 16 | 18 |
19 | 20 | 21 |
22 | 23 | {% endblock content %} 24 | -------------------------------------------------------------------------------- /chapter06/Alexandria/people/admin.py: -------------------------------------------------------------------------------- 1 | # Alexandria/people/admin.py 2 | from django.contrib import admin 3 | from django.contrib.auth.admin import UserAdmin as BaseUserAdmin 4 | from django.contrib.auth.models import User 5 | 6 | from people.models import Reader 7 | 8 | class ReaderInline(admin.StackedInline): 9 | model = Reader 10 | can_delete = False 11 | 12 | 13 | # Overload User admin model 14 | class UserAdmin(BaseUserAdmin): 15 | inlines = (ReaderInline, ) 16 | 17 | def get_inline_instances(self, request, obj=None): 18 | if not obj: 19 | return list() 20 | 21 | return super(UserAdmin, self).get_inline_instances(request, obj) 22 | 23 | # Register new User admin 24 | admin.site.unregister(User) 25 | admin.site.register(User, UserAdmin) 26 | -------------------------------------------------------------------------------- /chapter07/Alexandria/Alexandria/urls.py: -------------------------------------------------------------------------------- 1 | # Alexandria/Alexandria/urls.py 2 | 3 | from django.contrib import admin 4 | from django.urls import path, include 5 | from django.views.generic.base import RedirectView 6 | 7 | from primer.views import say_hello 8 | from home import views as home_views 9 | 10 | urlpatterns = [ 11 | path('favicon.ico', RedirectView.as_view(url='/static/favicon.ico')), 12 | 13 | path('admin/', admin.site.urls), 14 | path('accounts/', include('django.contrib.auth.urls')), 15 | 16 | path('say_hello/', say_hello), 17 | path('home/', include('home.urls')), 18 | path('', home_views.home), 19 | path('catalog/', include('catalog.urls')), 20 | path('people/', include('people.urls')), 21 | path('review/', include('review.urls')), 22 | ] 23 | -------------------------------------------------------------------------------- /chapter10/Alexandria/music/migrations/0001_initial_squashed_0002_song_artist_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.7 on 2021-11-30 18:56 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | replaces = [('music', '0001_initial'), ('music', '0002_song_artist_name')] 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Song', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=50)), 19 | ('artist_name', models.CharField(default='unknown', max_length=50)), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /chapter12/Alexandria/music/migrations/0001_initial_squashed_0002_song_artist_name.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.7 on 2021-11-30 18:56 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | replaces = [('music', '0001_initial'), ('music', '0002_song_artist_name')] 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Song', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('title', models.CharField(max_length=50)), 19 | ('artist_name', models.CharField(default='unknown', max_length=50)), 20 | ], 21 | ), 22 | ] 23 | -------------------------------------------------------------------------------- /chapter09/Alexandria/catalog/management/commands/authors.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/management/commands/authors.py 2 | from django.core.management.base import BaseCommand 3 | 4 | from catalog.models import Author 5 | 6 | class Command(BaseCommand): 7 | help = 'Lists authors in the Library Alexandria' 8 | 9 | def handle(self, *args, **options): 10 | for author in Author.objects.all(): 11 | output = [f'{author.last_name}'] 12 | 13 | if author.first_name: 14 | output.append(f', {author.first_name}') 15 | 16 | output.append(f' ({author.birth_year})') 17 | 18 | if author.picture: 19 | output.append(f' {author.picture.name}') 20 | else: 21 | output.append(f' no picture') 22 | 23 | self.stdout.write(''.join(output)) 24 | -------------------------------------------------------------------------------- /chapter10/Alexandria/catalog/management/commands/authors.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/management/commands/authors.py 2 | from django.core.management.base import BaseCommand 3 | 4 | from catalog.models import Author 5 | 6 | class Command(BaseCommand): 7 | help = 'Lists authors in the Library Alexandria' 8 | 9 | def handle(self, *args, **options): 10 | for author in Author.objects.all(): 11 | output = [f'{author.last_name}'] 12 | 13 | if author.first_name: 14 | output.append(f', {author.first_name}') 15 | 16 | output.append(f' ({author.birth_year})') 17 | 18 | if author.picture: 19 | output.append(f' {author.picture.name}') 20 | else: 21 | output.append(f' no picture') 22 | 23 | self.stdout.write(''.join(output)) 24 | -------------------------------------------------------------------------------- /chapter12/Alexandria/catalog/management/commands/authors.py: -------------------------------------------------------------------------------- 1 | # Alexandria/catalog/management/commands/authors.py 2 | from django.core.management.base import BaseCommand 3 | 4 | from catalog.models import Author 5 | 6 | class Command(BaseCommand): 7 | help = 'Lists authors in the Library Alexandria' 8 | 9 | def handle(self, *args, **options): 10 | for author in Author.objects.all(): 11 | output = [f'{author.last_name}'] 12 | 13 | if author.first_name: 14 | output.append(f', {author.first_name}') 15 | 16 | output.append(f' ({author.birth_year})') 17 | 18 | if author.picture: 19 | output.append(f' {author.picture.name}') 20 | else: 21 | output.append(f' no picture') 22 | 23 | self.stdout.write(''.join(output)) 24 | -------------------------------------------------------------------------------- /chapter03/Alexandria/home/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/views.py 2 | from django.shortcuts import render 3 | 4 | def sample(request): 5 | data = { 6 | 'books':[ 7 | { 8 | 'title':"Frankenstein", 9 | 'author':"Shelley, Mary", 10 | }, 11 | { 12 | 'title':"Metamorphosis", 13 | 'author':"Kafka, Franz", 14 | 'recommended':True, 15 | }, 16 | { 17 | 'title':"Dracula", 18 | 'author':"Stoker, Bram", 19 | 'recommended':False, 20 | }, 21 | ] 22 | } 23 | 24 | return render(request, "sample.html", data) 25 | 26 | 27 | def about(request): 28 | return render(request, "about.html") 29 | 30 | 31 | def home(request): 32 | return render(request, "home.html") 33 | -------------------------------------------------------------------------------- /chapter07/Alexandria/review/models.py: -------------------------------------------------------------------------------- 1 | # review/models.py 2 | from django.contrib.auth.models import User 3 | from django.core.validators import MinValueValidator, MaxValueValidator 4 | from django.db import models 5 | 6 | from catalog.models import Book 7 | 8 | class Review(models.Model): 9 | user = models.ForeignKey(User, on_delete=models.CASCADE) 10 | book = models.ForeignKey(Book, on_delete=models.CASCADE) 11 | rating = models.PositiveSmallIntegerField( 12 | validators=(MinValueValidator(1), MaxValueValidator(5))) 13 | text = models.TextField() 14 | 15 | class Meta: 16 | constraints = [ 17 | models.UniqueConstraint(fields=['user', 'book'], 18 | name="unique_review"), 19 | ] 20 | 21 | def __str__(self): 22 | return f"Review(id={self.id}, user={self.user.username}, book={self.book.title})" 23 | -------------------------------------------------------------------------------- /chapter08/Alexandria/review/models.py: -------------------------------------------------------------------------------- 1 | # review/models.py 2 | from django.contrib.auth.models import User 3 | from django.core.validators import MinValueValidator, MaxValueValidator 4 | from django.db import models 5 | 6 | from catalog.models import Book 7 | 8 | class Review(models.Model): 9 | user = models.ForeignKey(User, on_delete=models.CASCADE) 10 | book = models.ForeignKey(Book, on_delete=models.CASCADE) 11 | rating = models.PositiveSmallIntegerField( 12 | validators=(MinValueValidator(1), MaxValueValidator(5))) 13 | text = models.TextField() 14 | 15 | class Meta: 16 | constraints = [ 17 | models.UniqueConstraint(fields=['user', 'book'], 18 | name="unique_review"), 19 | ] 20 | 21 | def __str__(self): 22 | return f"Review(id={self.id}, user={self.user.username}, book={self.book.title})" 23 | -------------------------------------------------------------------------------- /chapter09/Alexandria/review/models.py: -------------------------------------------------------------------------------- 1 | # review/models.py 2 | from django.contrib.auth.models import User 3 | from django.core.validators import MinValueValidator, MaxValueValidator 4 | from django.db import models 5 | 6 | from catalog.models import Book 7 | 8 | class Review(models.Model): 9 | user = models.ForeignKey(User, on_delete=models.CASCADE) 10 | book = models.ForeignKey(Book, on_delete=models.CASCADE) 11 | rating = models.PositiveSmallIntegerField( 12 | validators=(MinValueValidator(1), MaxValueValidator(5))) 13 | text = models.TextField() 14 | 15 | class Meta: 16 | constraints = [ 17 | models.UniqueConstraint(fields=['user', 'book'], 18 | name="unique_review"), 19 | ] 20 | 21 | def __str__(self): 22 | return f"Review(id={self.id}, user={self.user.username}, book={self.book.title})" 23 | -------------------------------------------------------------------------------- /chapter10/Alexandria/review/models.py: -------------------------------------------------------------------------------- 1 | # review/models.py 2 | from django.contrib.auth.models import User 3 | from django.core.validators import MinValueValidator, MaxValueValidator 4 | from django.db import models 5 | 6 | from catalog.models import Book 7 | 8 | class Review(models.Model): 9 | user = models.ForeignKey(User, on_delete=models.CASCADE) 10 | book = models.ForeignKey(Book, on_delete=models.CASCADE) 11 | rating = models.PositiveSmallIntegerField( 12 | validators=(MinValueValidator(1), MaxValueValidator(5))) 13 | text = models.TextField() 14 | 15 | class Meta: 16 | constraints = [ 17 | models.UniqueConstraint(fields=['user', 'book'], 18 | name="unique_review"), 19 | ] 20 | 21 | def __str__(self): 22 | return f"Review(id={self.id}, user={self.user.username}, book={self.book.title})" 23 | -------------------------------------------------------------------------------- /chapter12/Alexandria/review/models.py: -------------------------------------------------------------------------------- 1 | # review/models.py 2 | from django.contrib.auth.models import User 3 | from django.core.validators import MinValueValidator, MaxValueValidator 4 | from django.db import models 5 | 6 | from catalog.models import Book 7 | 8 | class Review(models.Model): 9 | user = models.ForeignKey(User, on_delete=models.CASCADE) 10 | book = models.ForeignKey(Book, on_delete=models.CASCADE) 11 | rating = models.PositiveSmallIntegerField( 12 | validators=(MinValueValidator(1), MaxValueValidator(5))) 13 | text = models.TextField() 14 | 15 | class Meta: 16 | constraints = [ 17 | models.UniqueConstraint(fields=['user', 'book'], 18 | name="unique_review"), 19 | ] 20 | 21 | def __str__(self): 22 | return f"Review(id={self.id}, user={self.user.username}, book={self.book.title})" 23 | -------------------------------------------------------------------------------- /chapter04/Alexandria/home/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | def sample(request): 6 | data = { 7 | 'books':[ 8 | { 9 | 'title':"Frankenstein", 10 | 'author':"Shelley, Mary", 11 | }, 12 | { 13 | 'title':"Metamorphosis", 14 | 'author':"Kafka, Franz", 15 | 'recommended':True, 16 | }, 17 | { 18 | 'title':"Dracula", 19 | 'author':"Stoker, Bram", 20 | 'recommended':False, 21 | }, 22 | ] 23 | } 24 | 25 | return render(request, "sample.html", data) 26 | 27 | 28 | def about(request): 29 | return render(request, "about.html") 30 | 31 | 32 | def home(request): 33 | return render(request, "home.html") 34 | -------------------------------------------------------------------------------- /chapter05/Alexandria/home/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | def sample(request): 6 | data = { 7 | 'books':[ 8 | { 9 | 'title':"Frankenstein", 10 | 'author':"Shelley, Mary", 11 | }, 12 | { 13 | 'title':"Metamorphosis", 14 | 'author':"Kafka, Franz", 15 | 'recommended':True, 16 | }, 17 | { 18 | 'title':"Dracula", 19 | 'author':"Stoker, Bram", 20 | 'recommended':False, 21 | }, 22 | ] 23 | } 24 | 25 | return render(request, "sample.html", data) 26 | 27 | 28 | def about(request): 29 | return render(request, "about.html") 30 | 31 | 32 | def home(request): 33 | return render(request, "home.html") 34 | -------------------------------------------------------------------------------- /chapter06/Alexandria/home/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | def sample(request): 6 | data = { 7 | 'books':[ 8 | { 9 | 'title':"Frankenstein", 10 | 'author':"Shelley, Mary", 11 | }, 12 | { 13 | 'title':"Metamorphosis", 14 | 'author':"Kafka, Franz", 15 | 'recommended':True, 16 | }, 17 | { 18 | 'title':"Dracula", 19 | 'author':"Stoker, Bram", 20 | 'recommended':False, 21 | }, 22 | ] 23 | } 24 | 25 | return render(request, "sample.html", data) 26 | 27 | 28 | def about(request): 29 | return render(request, "about.html") 30 | 31 | 32 | def home(request): 33 | return render(request, "home.html") 34 | -------------------------------------------------------------------------------- /chapter07/Alexandria/home/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | def sample(request): 6 | data = { 7 | 'books':[ 8 | { 9 | 'title':"Frankenstein", 10 | 'author':"Shelley, Mary", 11 | }, 12 | { 13 | 'title':"Metamorphosis", 14 | 'author':"Kafka, Franz", 15 | 'recommended':True, 16 | }, 17 | { 18 | 'title':"Dracula", 19 | 'author':"Stoker, Bram", 20 | 'recommended':False, 21 | }, 22 | ] 23 | } 24 | 25 | return render(request, "sample.html", data) 26 | 27 | 28 | def about(request): 29 | return render(request, "about.html") 30 | 31 | 32 | def home(request): 33 | return render(request, "home.html") 34 | -------------------------------------------------------------------------------- /chapter08/Alexandria/home/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | def sample(request): 6 | data = { 7 | 'books':[ 8 | { 9 | 'title':"Frankenstein", 10 | 'author':"Shelley, Mary", 11 | }, 12 | { 13 | 'title':"Metamorphosis", 14 | 'author':"Kafka, Franz", 15 | 'recommended':True, 16 | }, 17 | { 18 | 'title':"Dracula", 19 | 'author':"Stoker, Bram", 20 | 'recommended':False, 21 | }, 22 | ] 23 | } 24 | 25 | return render(request, "sample.html", data) 26 | 27 | 28 | def about(request): 29 | return render(request, "about.html") 30 | 31 | 32 | def home(request): 33 | return render(request, "home.html") 34 | -------------------------------------------------------------------------------- /chapter09/Alexandria/home/views.py: -------------------------------------------------------------------------------- 1 | # Alexandria/home/views.py 2 | 3 | from django.shortcuts import render 4 | 5 | def sample(request): 6 | data = { 7 | 'books':[ 8 | { 9 | 'title':"Frankenstein", 10 | 'author':"Shelley, Mary", 11 | }, 12 | { 13 | 'title':"Metamorphosis", 14 | 'author':"Kafka, Franz", 15 | 'recommended':True, 16 | }, 17 | { 18 | 'title':"Dracula", 19 | 'author':"Stoker, Bram", 20 | 'recommended':False, 21 | }, 22 | ] 23 | } 24 | 25 | return render(request, "sample.html", data) 26 | 27 | 28 | def about(request): 29 | return render(request, "about.html") 30 | 31 | 32 | def home(request): 33 | return render(request, "home.html") 34 | --------------------------------------------------------------------------------