├── .gitignore ├── .gitpod.dockerfile ├── .gitpod.yml ├── .vscode ├── client.cnf ├── font_fix.py ├── heroku_config.sh ├── init_tasks.sh ├── launch.json ├── mysql.cnf ├── settings.json ├── settings_font.json ├── since_update.sh ├── start_mysql.sh └── update_bashrc.sh ├── 01_creating_the_project ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py └── requirements.txt ├── 02_our_first_deployment_part_1 ├── .gitignore ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py └── requirements.txt ├── 03_our_first_deployment_part_2 ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py └── requirements.txt ├── 04_building_the_models ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py └── requirements.txt ├── 05_building_the_admin_site ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py └── requirements.txt ├── 06_creating_our_first_view ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ ├── 0003_alter_post_status.py │ │ ├── 0004_alter_post_status.py │ │ ├── 0005_auto_20210527_1517.py │ │ ├── 0006_alter_post_featured_image.py │ │ ├── 0007_alter_post_featured_image.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── requirements.txt ├── static │ └── css │ │ └── style.css └── templates │ ├── base.html │ ├── index.html │ └── post_detail.html ├── 07_adding_post_detail ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ ├── 0003_alter_post_status.py │ │ ├── 0004_alter_post_status.py │ │ ├── 0005_auto_20210527_1517.py │ │ ├── 0006_alter_post_featured_image.py │ │ ├── 0007_alter_post_featured_image.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── requirements.txt ├── static │ └── css │ │ └── style.css └── templates │ ├── base.html │ ├── index.html │ └── post_detail.html ├── 08_authorisation ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ ├── 0003_alter_post_status.py │ │ ├── 0004_alter_post_status.py │ │ ├── 0005_auto_20210527_1517.py │ │ ├── 0006_alter_post_featured_image.py │ │ ├── 0007_alter_post_featured_image.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── requirements.txt ├── static │ └── css │ │ └── style.css └── templates │ ├── account │ ├── account_inactive.html │ ├── base.html │ ├── email.html │ ├── email │ │ ├── base_message.txt │ │ ├── email_confirmation_message.txt │ │ ├── email_confirmation_signup_message.txt │ │ ├── email_confirmation_signup_subject.txt │ │ ├── email_confirmation_subject.txt │ │ ├── password_reset_key_message.txt │ │ └── password_reset_key_subject.txt │ ├── email_confirm.html │ ├── login.html │ ├── logout.html │ ├── messages │ │ ├── cannot_delete_primary_email.txt │ │ ├── email_confirmation_sent.txt │ │ ├── email_confirmed.txt │ │ ├── email_deleted.txt │ │ ├── logged_in.txt │ │ ├── logged_out.txt │ │ ├── password_changed.txt │ │ ├── password_set.txt │ │ ├── primary_email_set.txt │ │ └── unverified_primary_email.txt │ ├── password_change.html │ ├── password_reset.html │ ├── password_reset_done.html │ ├── password_reset_from_key.html │ ├── password_reset_from_key_done.html │ ├── password_set.html │ ├── signup.html │ ├── signup_closed.html │ ├── snippets │ │ └── already_logged_in.html │ ├── verification_sent.html │ └── verified_email_required.html │ ├── base.html │ ├── index.html │ ├── openid │ ├── base.html │ └── login.html │ ├── post_detail.html │ ├── socialaccount │ ├── authentication_error.html │ ├── base.html │ ├── connections.html │ ├── login_cancelled.html │ ├── messages │ │ ├── account_connected.txt │ │ ├── account_connected_other.txt │ │ ├── account_connected_updated.txt │ │ └── account_disconnected.txt │ ├── signup.html │ └── snippets │ │ ├── login_extra.html │ │ └── provider_list.html │ └── tests │ └── test_403_csrf.html ├── 09_commenting ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ ├── 0003_alter_post_status.py │ │ ├── 0004_alter_post_status.py │ │ ├── 0005_auto_20210527_1517.py │ │ ├── 0006_alter_post_featured_image.py │ │ ├── 0007_alter_post_featured_image.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── requirements.txt ├── static │ └── css │ │ └── style.css └── templates │ ├── account │ ├── account_inactive.html │ ├── base.html │ ├── email.html │ ├── email │ │ ├── base_message.txt │ │ ├── email_confirmation_message.txt │ │ ├── email_confirmation_signup_message.txt │ │ ├── email_confirmation_signup_subject.txt │ │ ├── email_confirmation_subject.txt │ │ ├── password_reset_key_message.txt │ │ └── password_reset_key_subject.txt │ ├── email_confirm.html │ ├── login.html │ ├── logout.html │ ├── messages │ │ ├── cannot_delete_primary_email.txt │ │ ├── email_confirmation_sent.txt │ │ ├── email_confirmed.txt │ │ ├── email_deleted.txt │ │ ├── logged_in.txt │ │ ├── logged_out.txt │ │ ├── password_changed.txt │ │ ├── password_set.txt │ │ ├── primary_email_set.txt │ │ └── unverified_primary_email.txt │ ├── password_change.html │ ├── password_reset.html │ ├── password_reset_done.html │ ├── password_reset_from_key.html │ ├── password_reset_from_key_done.html │ ├── password_set.html │ ├── signup.html │ ├── signup_closed.html │ ├── snippets │ │ └── already_logged_in.html │ ├── verification_sent.html │ └── verified_email_required.html │ ├── base.html │ ├── index.html │ ├── openid │ ├── base.html │ └── login.html │ ├── post_detail.html │ ├── socialaccount │ ├── authentication_error.html │ ├── base.html │ ├── connections.html │ ├── login_cancelled.html │ ├── messages │ │ ├── account_connected.txt │ │ ├── account_connected_other.txt │ │ ├── account_connected_updated.txt │ │ └── account_disconnected.txt │ ├── signup.html │ └── snippets │ │ ├── login_extra.html │ │ └── provider_list.html │ └── tests │ └── test_403_csrf.html ├── 10_likes ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ ├── 0003_alter_post_status.py │ │ ├── 0004_alter_post_status.py │ │ ├── 0005_auto_20210527_1517.py │ │ ├── 0006_alter_post_featured_image.py │ │ ├── 0007_alter_post_featured_image.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── requirements.txt ├── static │ └── css │ │ └── style.css └── templates │ ├── account │ ├── account_inactive.html │ ├── base.html │ ├── email.html │ ├── email │ │ ├── base_message.txt │ │ ├── email_confirmation_message.txt │ │ ├── email_confirmation_signup_message.txt │ │ ├── email_confirmation_signup_subject.txt │ │ ├── email_confirmation_subject.txt │ │ ├── password_reset_key_message.txt │ │ └── password_reset_key_subject.txt │ ├── email_confirm.html │ ├── login.html │ ├── logout.html │ ├── messages │ │ ├── cannot_delete_primary_email.txt │ │ ├── email_confirmation_sent.txt │ │ ├── email_confirmed.txt │ │ ├── email_deleted.txt │ │ ├── logged_in.txt │ │ ├── logged_out.txt │ │ ├── password_changed.txt │ │ ├── password_set.txt │ │ ├── primary_email_set.txt │ │ └── unverified_primary_email.txt │ ├── password_change.html │ ├── password_reset.html │ ├── password_reset_done.html │ ├── password_reset_from_key.html │ ├── password_reset_from_key_done.html │ ├── password_set.html │ ├── signup.html │ ├── signup_closed.html │ ├── snippets │ │ └── already_logged_in.html │ ├── verification_sent.html │ └── verified_email_required.html │ ├── base.html │ ├── index.html │ ├── openid │ ├── base.html │ └── login.html │ ├── post_detail.html │ ├── socialaccount │ ├── authentication_error.html │ ├── base.html │ ├── connections.html │ ├── login_cancelled.html │ ├── messages │ │ ├── account_connected.txt │ │ ├── account_connected_other.txt │ │ ├── account_connected_updated.txt │ │ └── account_disconnected.txt │ ├── signup.html │ └── snippets │ │ ├── login_extra.html │ │ └── provider_list.html │ └── tests │ └── test_403_csrf.html ├── 11_messages ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ ├── 0003_alter_post_status.py │ │ ├── 0004_alter_post_status.py │ │ ├── 0005_auto_20210527_1517.py │ │ ├── 0006_alter_post_featured_image.py │ │ ├── 0007_alter_post_featured_image.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── requirements.txt ├── static │ └── css │ │ └── style.css └── templates │ ├── account │ ├── account_inactive.html │ ├── base.html │ ├── email.html │ ├── email │ │ ├── base_message.txt │ │ ├── email_confirmation_message.txt │ │ ├── email_confirmation_signup_message.txt │ │ ├── email_confirmation_signup_subject.txt │ │ ├── email_confirmation_subject.txt │ │ ├── password_reset_key_message.txt │ │ └── password_reset_key_subject.txt │ ├── email_confirm.html │ ├── login.html │ ├── logout.html │ ├── messages │ │ ├── cannot_delete_primary_email.txt │ │ ├── email_confirmation_sent.txt │ │ ├── email_confirmed.txt │ │ ├── email_deleted.txt │ │ ├── logged_in.txt │ │ ├── logged_out.txt │ │ ├── password_changed.txt │ │ ├── password_set.txt │ │ ├── primary_email_set.txt │ │ └── unverified_primary_email.txt │ ├── password_change.html │ ├── password_reset.html │ ├── password_reset_done.html │ ├── password_reset_from_key.html │ ├── password_reset_from_key_done.html │ ├── password_set.html │ ├── signup.html │ ├── signup_closed.html │ ├── snippets │ │ └── already_logged_in.html │ ├── verification_sent.html │ └── verified_email_required.html │ ├── base.html │ ├── index.html │ ├── openid │ ├── base.html │ └── login.html │ ├── post_detail.html │ ├── socialaccount │ ├── authentication_error.html │ ├── base.html │ ├── connections.html │ ├── login_cancelled.html │ ├── messages │ │ ├── account_connected.txt │ │ ├── account_connected_other.txt │ │ ├── account_connected_updated.txt │ │ └── account_disconnected.txt │ ├── signup.html │ └── snippets │ │ ├── login_extra.html │ │ └── provider_list.html │ └── tests │ └── test_403_csrf.html ├── 12_final_deployment ├── .gitignore ├── Procfile ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── forms.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_comment.py │ │ ├── 0003_alter_post_status.py │ │ ├── 0004_alter_post_status.py │ │ ├── 0005_auto_20210527_1517.py │ │ ├── 0006_alter_post_featured_image.py │ │ ├── 0007_alter_post_featured_image.py │ │ └── __init__.py │ ├── models.py │ ├── tests.py │ ├── urls.py │ └── views.py ├── codestar │ ├── __init__.py │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── db.sqlite3 ├── manage.py ├── requirements.txt ├── static │ └── css │ │ └── style.css └── templates │ ├── account │ ├── account_inactive.html │ ├── base.html │ ├── email.html │ ├── email │ │ ├── base_message.txt │ │ ├── email_confirmation_message.txt │ │ ├── email_confirmation_signup_message.txt │ │ ├── email_confirmation_signup_subject.txt │ │ ├── email_confirmation_subject.txt │ │ ├── password_reset_key_message.txt │ │ └── password_reset_key_subject.txt │ ├── email_confirm.html │ ├── login.html │ ├── logout.html │ ├── messages │ │ ├── cannot_delete_primary_email.txt │ │ ├── email_confirmation_sent.txt │ │ ├── email_confirmed.txt │ │ ├── email_deleted.txt │ │ ├── logged_in.txt │ │ ├── logged_out.txt │ │ ├── password_changed.txt │ │ ├── password_set.txt │ │ ├── primary_email_set.txt │ │ └── unverified_primary_email.txt │ ├── password_change.html │ ├── password_reset.html │ ├── password_reset_done.html │ ├── password_reset_from_key.html │ ├── password_reset_from_key_done.html │ ├── password_set.html │ ├── signup.html │ ├── signup_closed.html │ ├── snippets │ │ └── already_logged_in.html │ ├── verification_sent.html │ └── verified_email_required.html │ ├── base.html │ ├── index.html │ ├── openid │ ├── base.html │ └── login.html │ ├── post_detail.html │ ├── socialaccount │ ├── authentication_error.html │ ├── base.html │ ├── connections.html │ ├── login_cancelled.html │ ├── messages │ │ ├── account_connected.txt │ │ ├── account_connected_other.txt │ │ ├── account_connected_updated.txt │ │ └── account_disconnected.txt │ ├── signup.html │ └── snippets │ │ ├── login_extra.html │ │ └── provider_list.html │ └── tests │ └── test_403_csrf.html └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | final_project/ 9 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.dockerfile 3 | tasks: 4 | - init: . ${GITPOD_REPO_ROOT}/.vscode/init_tasks.sh 5 | vscode: 6 | extensions: 7 | - ms-python.python 8 | - formulahendry.auto-close-tag 9 | - mkaufman.HTMLHint 10 | - eventyret.bootstrap-4-cdn-snippet 11 | - kevinglasson.cornflakes-linter 12 | - hookyqr.beautify 13 | -------------------------------------------------------------------------------- /.vscode/client.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | host = localhost 3 | user = root 4 | password = 5 | socket = /var/run/mysqld/mysqld.sock 6 | [mysql_upgrade] 7 | host = localhost 8 | user = root 9 | password = 10 | socket = /var/run/mysqld/mysqld.sock 11 | -------------------------------------------------------------------------------- /.vscode/font_fix.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | BASE_PATH = os.environ.get("GITPOD_REPO_ROOT") 5 | 6 | with open(f"{BASE_PATH}/.vscode/settings.json", "r+") as f: 7 | content = json.loads(f.read()) 8 | 9 | if "terminal.integrated.fontFamily" not in content: 10 | content["terminal.integrated.fontFamily"] = "Menlo" 11 | else: 12 | content.pop("terminal.integrated.fontFamily") 13 | 14 | f.seek(0, os.SEEK_SET) 15 | f.write(json.dumps(content)) 16 | f.truncate() 17 | -------------------------------------------------------------------------------- /.vscode/heroku_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Script to allow Heroku API key to be pasted 3 | # exported as an environment variable 4 | # 5 | # Matt Rudge, May 2021 6 | 7 | echo Heroku authentication configuration script 8 | echo Code Institute, 2021 9 | echo 10 | echo Get your Heroku API key by going to https://dashboard.heroku.com 11 | echo Go to Account Settings and click on Reveal to view your Heroku API key 12 | echo 13 | 14 | if [[ -z "${HEROKU_API_KEY}" ]]; then 15 | echo Paste your Heroku API key here or press Enter to quit: 16 | read apikey 17 | if [[ -z "${apikey}" ]]; then 18 | return 0 19 | fi 20 | echo export HEROKU_API_KEY=${apikey} >> ~/.bashrc 21 | echo Added the export. Refreshing the terminal. 22 | . ~/.bashrc > /dev/null 23 | echo Done! 24 | else 25 | echo API key is already set. Exiting 26 | fi 27 | -------------------------------------------------------------------------------- /.vscode/init_tasks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Creates a user record for the current Cloud9 user 4 | # Gives a personalised greeting 5 | # Adds configuration options for SQLite 6 | # Creates run aliases 7 | # Author: Matt Rudge 8 | 9 | echo "Setting the greeting" 10 | sed -i "s/USER_NAME/$GITPOD_GIT_USER_NAME/g" ${GITPOD_REPO_ROOT}/README.md 11 | echo "Creating the ${C9_USER} user in MySQL" 12 | RESULT="$(mysql -sse "SELECT EXISTS(SELECT 1 FROM mysql.user WHERE user = '${C9_USER}')")" 13 | if [ "$RESULT" = 1 ]; then 14 | echo "${C9_USER} already exists" 15 | else 16 | mysql -e "CREATE USER '${C9_USER}'@'%' IDENTIFIED BY '';" -u root 17 | echo "Granting privileges" 18 | mysql -e "GRANT ALL PRIVILEGES ON *.* TO '${C9_USER}'@'%' WITH GRANT OPTION;" -u root 19 | fi 20 | echo "Creating .sqliterc file" 21 | echo ".headers on" > ~/.sqliterc 22 | echo ".mode column" >> ~/.sqliterc 23 | echo "Your workspace is ready to use. Happy coding!" 24 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | "version": "0.2.0", 5 | "configurations": [ 6 | { 7 | "name": "Python: Current File (Integrated Terminal)", 8 | "type": "python", 9 | "request": "launch", 10 | "program": "${file}", 11 | "console": "internalConsole" 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.vscode/mysql.cnf: -------------------------------------------------------------------------------- 1 | [mysqld_safe] 2 | socket = /var/run/mysqld/mysqld.sock 3 | nice = 0 4 | 5 | [mysqld] 6 | user = gitpod 7 | pid-file = /var/run/mysqld/mysqld.pid 8 | socket = /var/run/mysqld/mysqld.sock 9 | port = 3306 10 | basedir = /usr 11 | datadir = /workspace/mysql 12 | tmpdir = /tmp 13 | lc-messages-dir = /usr/share/mysql 14 | skip-external-locking 15 | 16 | key_buffer_size = 16M 17 | max_allowed_packet = 16M 18 | thread_stack = 192K 19 | thread_cache_size = 8 20 | 21 | myisam-recover-options = BACKUP 22 | 23 | general_log_file = /var/log/mysql/mysql.log 24 | general_log = 1 25 | log_error = /var/log/mysql/error.log 26 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | {"python.linting.pylintEnabled": true, "python.linting.enabled": true, "python.linting.pycodestyleEnabled": false, "python.linting.flake8Enabled": true, "python.terminal.activateEnvironment": false, "python.formatting.autopep8Path": "/home/gitpod/.pyenv/shims/autopep8", "python.linting.flake8Path": "/home/gitpod/.pyenv/shims/flake8", "cornflakes.linter.executablePath": "/home/gitpod/.pyenv/shims/flake8", "files.exclude": {"**/.DS_Store": true, "**/.git": true, "**/.gitp*": true, "**/.hg": true, "**/.svn": true, "**/.vscode": true, "**/core.Microsoft*": true, "**/core.mongo*": true, "**/core.python*": true, "**/CVS": true}, "files.autoSave": "off", "workbench.colorTheme": "Visual Studio Dark", "editor.defaultFormatter": "HookyQR.beautify"} -------------------------------------------------------------------------------- /.vscode/settings_font.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.linting.pylintEnabled": true, 3 | "python.linting.enabled": true, 4 | "python.linting.pycodestyleEnabled": false, 5 | "python.linting.flake8Enabled": true, 6 | "python.terminal.activateEnvironment": false, 7 | "python.formatting.autopep8Path": "/home/gitpod/.pyenv/shims/autopep8", 8 | "python.linting.flake8Path": "/home/gitpod/.pyenv/shims/flake8", 9 | "cornflakes.linter.executablePath": "/home/gitpod/.pyenv/shims/flake8", 10 | "files.exclude": { 11 | "**/.DS_Store": true, 12 | "**/.git": true, 13 | "**/.gitp*": true, 14 | "**/.hg": true, 15 | "**/.svn": true, 16 | "**/.vscode": true, 17 | "**/core.Microsoft*": true, 18 | "**/core.mongo*": true, 19 | "**/core.python*": true, 20 | "**/CVS": true 21 | }, 22 | "files.autoSave": "off", 23 | "workbench.colorTheme": "Visual Studio Dark", 24 | "editor.defaultFormatter": "HookyQR.beautify", 25 | "terminal.integrated.fontFamily": "Menlo", 26 | } 27 | -------------------------------------------------------------------------------- /.vscode/since_update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Post update script, add in changes to init_tasks.sh 3 | # that won't take effect in an upgraded workspace 4 | 5 | echo 'alias heroku_config=". $GITPOD_REPO_ROOT/.vscode/heroku_config.sh"' >> ~/.bashrc 6 | 7 | echo Post-upgrade changes applied 8 | -------------------------------------------------------------------------------- /.vscode/start_mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # this script is intended to be called from .bashrc 4 | # This is a workaround for not having something like supervisord 5 | 6 | if [ ! -e /var/run/mysqld/gitpod-init.lock ] 7 | then 8 | touch /var/run/mysqld/gitpod-init.lock 9 | 10 | # initialize database structures on disk, if needed 11 | [ ! -d /workspace/mysql ] && mysqld --initialize-insecure 12 | 13 | # launch database, if not running 14 | [ ! -e /var/run/mysqld/mysqld.pid ] && mysqld --daemonize 15 | 16 | rm /var/run/mysqld/gitpod-init.lock 17 | fi 18 | -------------------------------------------------------------------------------- /.vscode/update_bashrc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Adding run aliases" 4 | echo 'alias run="python3 $GITPOD_REPO_ROOT/manage.py runserver 0.0.0.0:8000"' >> ~/.bashrc 5 | echo 'alias heroku_config=". $GITPOD_REPO_ROOT/.vscode/heroku_config.sh"' >> ~/.bashrc 6 | echo 'alias python=python3' >> ~/.bashrc 7 | echo 'alias pip=pip3' >> ~/.bashrc 8 | echo 'python3 $GITPOD_REPO_ROOT/.vscode/font_fix.py' >> ~/.bashrc 9 | source ~/.bashrc -------------------------------------------------------------------------------- /01_creating_the_project/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/01_creating_the_project/blog/__init__.py -------------------------------------------------------------------------------- /01_creating_the_project/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /01_creating_the_project/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /01_creating_the_project/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/01_creating_the_project/blog/migrations/__init__.py -------------------------------------------------------------------------------- /01_creating_the_project/blog/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /01_creating_the_project/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /01_creating_the_project/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /01_creating_the_project/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/01_creating_the_project/codestar/__init__.py -------------------------------------------------------------------------------- /01_creating_the_project/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /01_creating_the_project/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | ] 22 | -------------------------------------------------------------------------------- /01_creating_the_project/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /01_creating_the_project/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/01_creating_the_project/db.sqlite3 -------------------------------------------------------------------------------- /01_creating_the_project/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'codestar.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 | -------------------------------------------------------------------------------- /01_creating_the_project/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | dj-database-url==0.5.0 3 | Django==3.2.3 4 | psycopg2==2.8.6 5 | pytz==2021.1 6 | sqlparse==0.4.1 7 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/02_our_first_deployment_part_1/blog/__init__.py -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/02_our_first_deployment_part_1/blog/migrations/__init__.py -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/blog/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/02_our_first_deployment_part_1/codestar/__init__.py -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | ] 22 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/02_our_first_deployment_part_1/db.sqlite3 -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/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', 'codestar.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 | -------------------------------------------------------------------------------- /02_our_first_deployment_part_1/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | dj-database-url==0.5.0 3 | Django==3.2.3 4 | gunicorn==20.1.0 5 | psycopg2==2.8.6 6 | pytz==2021.1 7 | sqlparse==0.4.1 8 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/03_our_first_deployment_part_2/blog/__init__.py -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/03_our_first_deployment_part_2/blog/migrations/__init__.py -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/blog/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/03_our_first_deployment_part_2/codestar/__init__.py -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | ] 22 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/03_our_first_deployment_part_2/db.sqlite3 -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/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', 'codestar.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 | -------------------------------------------------------------------------------- /03_our_first_deployment_part_2/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | dj-database-url==0.5.0 3 | Django==3.2.3 4 | gunicorn==20.1.0 5 | psycopg2==2.8.6 6 | pytz==2021.1 7 | sqlparse==0.4.1 8 | -------------------------------------------------------------------------------- /04_building_the_models/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /04_building_the_models/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /04_building_the_models/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/04_building_the_models/blog/__init__.py -------------------------------------------------------------------------------- /04_building_the_models/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /04_building_the_models/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /04_building_the_models/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/04_building_the_models/blog/migrations/__init__.py -------------------------------------------------------------------------------- /04_building_the_models/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /04_building_the_models/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /04_building_the_models/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/04_building_the_models/codestar/__init__.py -------------------------------------------------------------------------------- /04_building_the_models/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /04_building_the_models/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('summernote/', include('django_summernote.urls')), 22 | ] 23 | -------------------------------------------------------------------------------- /04_building_the_models/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /04_building_the_models/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/04_building_the_models/db.sqlite3 -------------------------------------------------------------------------------- /04_building_the_models/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', 'codestar.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 | -------------------------------------------------------------------------------- /04_building_the_models/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-summernote==0.8.11.6 7 | gunicorn==20.1.0 8 | psycopg2==2.8.6 9 | pytz==2021.1 10 | sqlparse==0.4.1 11 | -------------------------------------------------------------------------------- /05_building_the_admin_site/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /05_building_the_admin_site/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /05_building_the_admin_site/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/05_building_the_admin_site/blog/__init__.py -------------------------------------------------------------------------------- /05_building_the_admin_site/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /05_building_the_admin_site/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /05_building_the_admin_site/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/05_building_the_admin_site/blog/migrations/__init__.py -------------------------------------------------------------------------------- /05_building_the_admin_site/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /05_building_the_admin_site/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /05_building_the_admin_site/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/05_building_the_admin_site/codestar/__init__.py -------------------------------------------------------------------------------- /05_building_the_admin_site/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /05_building_the_admin_site/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('summernote/', include('django_summernote.urls')), 22 | ] 23 | -------------------------------------------------------------------------------- /05_building_the_admin_site/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /05_building_the_admin_site/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/05_building_the_admin_site/db.sqlite3 -------------------------------------------------------------------------------- /05_building_the_admin_site/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', 'codestar.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 | -------------------------------------------------------------------------------- /05_building_the_admin_site/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-summernote==0.8.11.6 7 | gunicorn==20.1.0 8 | psycopg2==2.8.6 9 | pytz==2021.1 10 | sqlparse==0.4.1 11 | -------------------------------------------------------------------------------- /06_creating_our_first_view/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /06_creating_our_first_view/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/06_creating_our_first_view/blog/__init__.py -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/migrations/0003_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_comment'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[('d', 'Draft'), ('p', 'Publish')], default='d'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/migrations/0004_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0003_alter_post_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/migrations/0005_auto_20210527_1517.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 15:17 2 | 3 | import cloudinary.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0004_alter_post_status'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='excerpt', 17 | field=models.TextField(blank=True), 18 | ), 19 | migrations.AddField( 20 | model_name='post', 21 | name='featured_image', 22 | field=cloudinary.models.CloudinaryField(default='media/default.jpg', max_length=255, verbose_name='image'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/migrations/0006_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:35 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0005_auto_20210527_1517'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='default', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/migrations/0007_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:39 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0006_alter_post_featured_image'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='placeholder', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/06_creating_our_first_view/blog/migrations/__init__.py -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/urls.py: -------------------------------------------------------------------------------- 1 | from . import views 2 | from django.urls import path 3 | 4 | urlpatterns = [ 5 | path("", views.PostList.as_view(), name="home"), 6 | ] 7 | -------------------------------------------------------------------------------- /06_creating_our_first_view/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views import generic 3 | from .models import Post 4 | 5 | 6 | class PostList(generic.ListView): 7 | model = Post 8 | queryset = Post.objects.filter(status=1).order_by("-created_on") 9 | template_name = "index.html" 10 | paginate_by = 6 11 | -------------------------------------------------------------------------------- /06_creating_our_first_view/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/06_creating_our_first_view/codestar/__init__.py -------------------------------------------------------------------------------- /06_creating_our_first_view/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /06_creating_our_first_view/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path("", include("blog.urls"), name="blog-urls"), 22 | path('summernote/', include('django_summernote.urls')), 23 | ] 24 | -------------------------------------------------------------------------------- /06_creating_our_first_view/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /06_creating_our_first_view/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/06_creating_our_first_view/db.sqlite3 -------------------------------------------------------------------------------- /06_creating_our_first_view/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', 'codestar.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 | -------------------------------------------------------------------------------- /06_creating_our_first_view/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-summernote==0.8.11.6 7 | gunicorn==20.1.0 8 | psycopg2==2.8.6 9 | pytz==2021.1 10 | sqlparse==0.4.1 11 | -------------------------------------------------------------------------------- /07_adding_post_detail/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /07_adding_post_detail/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /07_adding_post_detail/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/07_adding_post_detail/blog/__init__.py -------------------------------------------------------------------------------- /07_adding_post_detail/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/migrations/0003_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_comment'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[('d', 'Draft'), ('p', 'Publish')], default='d'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/migrations/0004_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0003_alter_post_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/migrations/0005_auto_20210527_1517.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 15:17 2 | 3 | import cloudinary.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0004_alter_post_status'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='excerpt', 17 | field=models.TextField(blank=True), 18 | ), 19 | migrations.AddField( 20 | model_name='post', 21 | name='featured_image', 22 | field=cloudinary.models.CloudinaryField(default='media/default.jpg', max_length=255, verbose_name='image'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/migrations/0006_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:35 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0005_auto_20210527_1517'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='default', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/migrations/0007_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:39 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0006_alter_post_featured_image'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='placeholder', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/07_adding_post_detail/blog/migrations/__init__.py -------------------------------------------------------------------------------- /07_adding_post_detail/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/urls.py: -------------------------------------------------------------------------------- 1 | from . import views 2 | from django.urls import path 3 | 4 | urlpatterns = [ 5 | path('', views.PostList.as_view(), name='home'), 6 | path('/', views.PostDetail.as_view(), name='post_detail'), 7 | ] 8 | -------------------------------------------------------------------------------- /07_adding_post_detail/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, get_object_or_404 2 | from django.views import generic, View 3 | from .models import Post 4 | 5 | 6 | class PostList(generic.ListView): 7 | model = Post 8 | queryset = Post.objects.filter(status=1).order_by("-created_on") 9 | template_name = "index.html" 10 | paginate_by = 6 11 | 12 | 13 | class PostDetail(View): 14 | 15 | def get(self, request, slug, *args, **kwargs): 16 | queryset = Post.objects.filter(status=1) 17 | post = get_object_or_404(queryset, slug=slug) 18 | comments = post.comments.filter(approved=True).order_by("-created_on") 19 | liked = False 20 | if post.likes.filter(id=self.request.user.id).exists(): 21 | liked = True 22 | 23 | return render( 24 | request, 25 | "post_detail.html", 26 | { 27 | "post": post, 28 | "comments": comments, 29 | "liked": liked 30 | }, 31 | ) -------------------------------------------------------------------------------- /07_adding_post_detail/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/07_adding_post_detail/codestar/__init__.py -------------------------------------------------------------------------------- /07_adding_post_detail/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /07_adding_post_detail/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path("", include("blog.urls"), name="blog-urls"), 22 | path('summernote/', include('django_summernote.urls')), 23 | ] 24 | -------------------------------------------------------------------------------- /07_adding_post_detail/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /07_adding_post_detail/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/07_adding_post_detail/db.sqlite3 -------------------------------------------------------------------------------- /07_adding_post_detail/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', 'codestar.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 | -------------------------------------------------------------------------------- /07_adding_post_detail/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-summernote==0.8.11.6 7 | gunicorn==20.1.0 8 | psycopg2==2.8.6 9 | pytz==2021.1 10 | sqlparse==0.4.1 11 | -------------------------------------------------------------------------------- /08_authorisation/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /08_authorisation/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /08_authorisation/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/08_authorisation/blog/__init__.py -------------------------------------------------------------------------------- /08_authorisation/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /08_authorisation/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /08_authorisation/blog/migrations/0003_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_comment'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[('d', 'Draft'), ('p', 'Publish')], default='d'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /08_authorisation/blog/migrations/0004_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0003_alter_post_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /08_authorisation/blog/migrations/0005_auto_20210527_1517.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 15:17 2 | 3 | import cloudinary.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0004_alter_post_status'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='excerpt', 17 | field=models.TextField(blank=True), 18 | ), 19 | migrations.AddField( 20 | model_name='post', 21 | name='featured_image', 22 | field=cloudinary.models.CloudinaryField(default='media/default.jpg', max_length=255, verbose_name='image'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /08_authorisation/blog/migrations/0006_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:35 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0005_auto_20210527_1517'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='default', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /08_authorisation/blog/migrations/0007_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:39 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0006_alter_post_featured_image'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='placeholder', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /08_authorisation/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/08_authorisation/blog/migrations/__init__.py -------------------------------------------------------------------------------- /08_authorisation/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /08_authorisation/blog/urls.py: -------------------------------------------------------------------------------- 1 | from . import views 2 | from django.urls import path 3 | 4 | urlpatterns = [ 5 | path('', views.PostList.as_view(), name='home'), 6 | path('/', views.PostDetail.as_view(), name='post_detail'), 7 | ] 8 | -------------------------------------------------------------------------------- /08_authorisation/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render, get_object_or_404 2 | from django.views import generic, View 3 | from .models import Post 4 | 5 | 6 | class PostList(generic.ListView): 7 | model = Post 8 | queryset = Post.objects.filter(status=1).order_by("-created_on") 9 | template_name = "index.html" 10 | paginate_by = 6 11 | 12 | 13 | class PostDetail(View): 14 | 15 | def get(self, request, slug, *args, **kwargs): 16 | queryset = Post.objects.filter(status=1) 17 | post = get_object_or_404(queryset, slug=slug) 18 | comments = post.comments.filter(approved=True).order_by("-created_on") 19 | liked = False 20 | if post.likes.filter(id=self.request.user.id).exists(): 21 | liked = True 22 | 23 | return render( 24 | request, 25 | "post_detail.html", 26 | { 27 | "post": post, 28 | "comments": comments, 29 | "liked": liked 30 | }, 31 | ) -------------------------------------------------------------------------------- /08_authorisation/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/08_authorisation/codestar/__init__.py -------------------------------------------------------------------------------- /08_authorisation/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /08_authorisation/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path("", include("blog.urls"), name="blog-urls"), 22 | path('summernote/', include('django_summernote.urls')), 23 | path("accounts/", include("allauth.urls")), 24 | ] 25 | -------------------------------------------------------------------------------- /08_authorisation/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /08_authorisation/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/08_authorisation/db.sqlite3 -------------------------------------------------------------------------------- /08_authorisation/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', 'codestar.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 | -------------------------------------------------------------------------------- /08_authorisation/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-allauth==0.44.0 7 | django-summernote==0.8.11.6 8 | gunicorn==20.1.0 9 | oauthlib==3.1.1 10 | psycopg2==2.8.6 11 | PyJWT==2.1.0 12 | python3-openid==3.2.0 13 | pytz==2021.1 14 | requests-oauthlib==1.3.0 15 | sqlparse==0.4.1 16 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/account_inactive.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Account Inactive" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Account Inactive" %}

9 | 10 |

{% trans "This account is inactive." %}

11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/email/base_message.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %} 2 | 3 | {% block content %}{% endblock %} 4 | 5 | {% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}! 6 | {{ site_domain }}{% endblocktrans %} 7 | {% endautoescape %} 8 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/email/email_confirmation_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load account %} 3 | {% load i18n %} 4 | 5 | {% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this e-mail because user {{ user_display }} has given your e-mail address to register an account on {{ site_domain }}. 6 | 7 | To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock %} 8 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/email/email_confirmation_signup_message.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_message.txt" %} 2 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/email/email_confirmation_signup_subject.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_subject.txt" %} 2 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/email/email_confirmation_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/email/password_reset_key_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load i18n %} 3 | 4 | {% block content %}{% autoescape off %}{% blocktrans %}You're receiving this e-mail because you or someone else has requested a password for your user account. 5 | It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %} 6 | 7 | {{ password_reset_url }}{% if username %} 8 | 9 | {% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock %} 10 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/email/password_reset_key_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Password Reset E-mail{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Out" %}{% endblock %} 6 | 7 | {% block content %} 8 |
9 |
10 |
11 |

{% trans "Sign Out" %}

12 | 13 |

{% trans 'Are you sure you want to sign out?' %}

14 |
15 |
16 |
17 |
18 | 19 |
20 | {% csrf_token %} 21 | {% if redirect_field_value %} 22 | 23 | {% endif %} 24 | 25 |
26 |
27 |
28 |
29 | {% endblock %} -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/cannot_delete_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/email_confirmation_sent.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/email_confirmed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have confirmed {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/email_deleted.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/logged_in.txt: -------------------------------------------------------------------------------- 1 | {% load account %} 2 | {% load i18n %} 3 | {% user_display user as name %} 4 | {% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %} 5 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/logged_out.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have signed out.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/password_changed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully changed.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/password_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/primary_email_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Primary e-mail address set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/messages/unverified_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/password_change.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Change Password" %}

9 | 10 |
11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 | {% trans "Forgot Password?" %} 15 |
16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/password_reset.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 | 10 |

{% trans "Password Reset" %}

11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

16 | 17 |
18 | {% csrf_token %} 19 | {{ form.as_p }} 20 | 21 |
22 | 23 |

{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 |

{% trans "Password Reset" %}

10 | 11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/password_reset_from_key_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 5 | 6 | {% block content %} 7 |

{% trans "Change Password" %}

8 |

{% trans 'Your password is now changed.' %}

9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/password_set.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Set Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Set Password" %}

9 | 10 |
11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/signup_closed.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Sign Up Closed" %}

9 | 10 |

{% trans "We are sorry, but the sign up is currently closed." %}

11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/snippets/already_logged_in.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load account %} 3 | 4 | {% user_display user as user_display %} 5 |

{% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}

6 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/verification_sent.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Verify Your E-mail Address" %}

9 | 10 |

{% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /08_authorisation/templates/account/verified_email_required.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Verify Your E-mail Address" %}

9 | 10 | {% url 'account_email' as email_url %} 11 | 12 |

{% blocktrans %}This part of the site requires us to verify that 13 | you are who you claim to be. For this purpose, we require that you 14 | verify ownership of your e-mail address. {% endblocktrans %}

15 | 16 |

{% blocktrans %}We have sent an e-mail to you for 17 | verification. Please click on the link inside this e-mail. Please 18 | contact us if you do not receive it within a few minutes.{% endblocktrans %}

19 | 20 |

{% blocktrans %}Note: you can still change your e-mail address.{% endblocktrans %}

21 | 22 | 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /08_authorisation/templates/openid/base.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | -------------------------------------------------------------------------------- /08_authorisation/templates/openid/login.html: -------------------------------------------------------------------------------- 1 | {% extends "openid/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}OpenID Sign In{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

{% trans 'OpenID Sign In' %}

10 | 11 | 12 | 17 | 18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/authentication_error.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Social Network Login Failure" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Social Network Login Failure" %}

9 | 10 |

{% trans "An error occurred while attempting to login via your social network account." %}

11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/base.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/login_cancelled.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Login Cancelled" %}{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

{% trans "Login Cancelled" %}

10 | 11 | {% url 'account_login' as login_url %} 12 | 13 |

{% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to sign in.{% endblocktrans %}

14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/messages/account_connected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been connected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/messages/account_connected_other.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account is already connected to a different account.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/messages/account_connected_updated.txt: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/messages/account_connected.txt" %} 2 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/messages/account_disconnected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been disconnected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |

{% trans "Sign Up" %}

9 | 10 |

{% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{provider_name}} account to login to 11 | {{site_name}}. As a final step, please complete the following form:{% endblocktrans %}

12 | 13 | 21 | 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/snippets/login_extra.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% providers_media_js %} 4 | -------------------------------------------------------------------------------- /08_authorisation/templates/socialaccount/snippets/provider_list.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% get_providers as socialaccount_providers %} 4 | 5 | {% for provider in socialaccount_providers %} 6 | {% if provider.id == "openid" %} 7 | {% for brand in provider.get_brands %} 8 |
  • 9 | {{brand.name}} 13 |
  • 14 | {% endfor %} 15 | {% endif %} 16 |
  • 17 | {{provider.name}} 19 |
  • 20 | {% endfor %} 21 | -------------------------------------------------------------------------------- /08_authorisation/templates/tests/test_403_csrf.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | Sign In 3 | -------------------------------------------------------------------------------- /09_commenting/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /09_commenting/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /09_commenting/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/09_commenting/blog/__init__.py -------------------------------------------------------------------------------- /09_commenting/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /09_commenting/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /09_commenting/blog/forms.py: -------------------------------------------------------------------------------- 1 | from .models import Comment 2 | from django import forms 3 | 4 | 5 | class CommentForm(forms.ModelForm): 6 | class Meta: 7 | model = Comment 8 | fields = ('body',) 9 | -------------------------------------------------------------------------------- /09_commenting/blog/migrations/0003_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_comment'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[('d', 'Draft'), ('p', 'Publish')], default='d'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /09_commenting/blog/migrations/0004_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0003_alter_post_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /09_commenting/blog/migrations/0005_auto_20210527_1517.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 15:17 2 | 3 | import cloudinary.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0004_alter_post_status'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='excerpt', 17 | field=models.TextField(blank=True), 18 | ), 19 | migrations.AddField( 20 | model_name='post', 21 | name='featured_image', 22 | field=cloudinary.models.CloudinaryField(default='media/default.jpg', max_length=255, verbose_name='image'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /09_commenting/blog/migrations/0006_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:35 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0005_auto_20210527_1517'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='default', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /09_commenting/blog/migrations/0007_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:39 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0006_alter_post_featured_image'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='placeholder', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /09_commenting/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/09_commenting/blog/migrations/__init__.py -------------------------------------------------------------------------------- /09_commenting/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /09_commenting/blog/urls.py: -------------------------------------------------------------------------------- 1 | from . import views 2 | from django.urls import path 3 | 4 | urlpatterns = [ 5 | path('', views.PostList.as_view(), name='home'), 6 | path('/', views.PostDetail.as_view(), name='post_detail'), 7 | ] 8 | -------------------------------------------------------------------------------- /09_commenting/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/09_commenting/codestar/__init__.py -------------------------------------------------------------------------------- /09_commenting/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /09_commenting/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path("", include("blog.urls"), name="blog-urls"), 22 | path('summernote/', include('django_summernote.urls')), 23 | path("accounts/", include("allauth.urls")), 24 | ] 25 | -------------------------------------------------------------------------------- /09_commenting/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /09_commenting/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/09_commenting/db.sqlite3 -------------------------------------------------------------------------------- /09_commenting/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', 'codestar.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 | -------------------------------------------------------------------------------- /09_commenting/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-allauth==0.44.0 7 | django-summernote==0.8.11.6 8 | gunicorn==20.1.0 9 | oauthlib==3.1.1 10 | psycopg2==2.8.6 11 | PyJWT==2.1.0 12 | python3-openid==3.2.0 13 | pytz==2021.1 14 | requests-oauthlib==1.3.0 15 | sqlparse==0.4.1 16 | -------------------------------------------------------------------------------- /09_commenting/templates/account/account_inactive.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Account Inactive" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Account Inactive" %}

    9 | 10 |

    {% trans "This account is inactive." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /09_commenting/templates/account/email/base_message.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %} 2 | 3 | {% block content %}{% endblock %} 4 | 5 | {% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}! 6 | {{ site_domain }}{% endblocktrans %} 7 | {% endautoescape %} 8 | -------------------------------------------------------------------------------- /09_commenting/templates/account/email/email_confirmation_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load account %} 3 | {% load i18n %} 4 | 5 | {% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this e-mail because user {{ user_display }} has given your e-mail address to register an account on {{ site_domain }}. 6 | 7 | To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock %} 8 | -------------------------------------------------------------------------------- /09_commenting/templates/account/email/email_confirmation_signup_message.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_message.txt" %} 2 | -------------------------------------------------------------------------------- /09_commenting/templates/account/email/email_confirmation_signup_subject.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_subject.txt" %} 2 | -------------------------------------------------------------------------------- /09_commenting/templates/account/email/email_confirmation_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /09_commenting/templates/account/email/password_reset_key_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load i18n %} 3 | 4 | {% block content %}{% autoescape off %}{% blocktrans %}You're receiving this e-mail because you or someone else has requested a password for your user account. 5 | It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %} 6 | 7 | {{ password_reset_url }}{% if username %} 8 | 9 | {% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock %} 10 | -------------------------------------------------------------------------------- /09_commenting/templates/account/email/password_reset_key_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Password Reset E-mail{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /09_commenting/templates/account/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Out" %}{% endblock %} 6 | 7 | {% block content %} 8 |
    9 |
    10 |
    11 |

    {% trans "Sign Out" %}

    12 | 13 |

    {% trans 'Are you sure you want to sign out?' %}

    14 |
    15 |
    16 |
    17 |
    18 | 19 |
    20 | {% csrf_token %} 21 | {% if redirect_field_value %} 22 | 23 | {% endif %} 24 | 25 |
    26 |
    27 |
    28 |
    29 | {% endblock %} -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/cannot_delete_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/email_confirmation_sent.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/email_confirmed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have confirmed {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/email_deleted.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/logged_in.txt: -------------------------------------------------------------------------------- 1 | {% load account %} 2 | {% load i18n %} 3 | {% user_display user as name %} 4 | {% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %} 5 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/logged_out.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have signed out.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/password_changed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully changed.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/password_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/primary_email_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Primary e-mail address set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/messages/unverified_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/account/password_change.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Change Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 | {% trans "Forgot Password?" %} 15 |
    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /09_commenting/templates/account/password_reset.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 | 10 |

    {% trans "Password Reset" %}

    11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

    16 | 17 |
    18 | {% csrf_token %} 19 | {{ form.as_p }} 20 | 21 |
    22 | 23 |

    {% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

    24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /09_commenting/templates/account/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 |

    {% trans "Password Reset" %}

    10 | 11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /09_commenting/templates/account/password_reset_from_key_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 5 | 6 | {% block content %} 7 |

    {% trans "Change Password" %}

    8 |

    {% trans 'Your password is now changed.' %}

    9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /09_commenting/templates/account/password_set.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Set Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Set Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 |
    15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /09_commenting/templates/account/signup_closed.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up Closed" %}

    9 | 10 |

    {% trans "We are sorry, but the sign up is currently closed." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /09_commenting/templates/account/snippets/already_logged_in.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load account %} 3 | 4 | {% user_display user as user_display %} 5 |

    {% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}

    6 | -------------------------------------------------------------------------------- /09_commenting/templates/account/verification_sent.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 |

    {% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /09_commenting/templates/account/verified_email_required.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 | {% url 'account_email' as email_url %} 11 | 12 |

    {% blocktrans %}This part of the site requires us to verify that 13 | you are who you claim to be. For this purpose, we require that you 14 | verify ownership of your e-mail address. {% endblocktrans %}

    15 | 16 |

    {% blocktrans %}We have sent an e-mail to you for 17 | verification. Please click on the link inside this e-mail. Please 18 | contact us if you do not receive it within a few minutes.{% endblocktrans %}

    19 | 20 |

    {% blocktrans %}Note: you can still change your e-mail address.{% endblocktrans %}

    21 | 22 | 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /09_commenting/templates/openid/base.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | -------------------------------------------------------------------------------- /09_commenting/templates/openid/login.html: -------------------------------------------------------------------------------- 1 | {% extends "openid/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}OpenID Sign In{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans 'OpenID Sign In' %}

    10 | 11 | 12 | 17 | 18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/authentication_error.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Social Network Login Failure" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Social Network Login Failure" %}

    9 | 10 |

    {% trans "An error occurred while attempting to login via your social network account." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/base.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/login_cancelled.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Login Cancelled" %}{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans "Login Cancelled" %}

    10 | 11 | {% url 'account_login' as login_url %} 12 | 13 |

    {% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to sign in.{% endblocktrans %}

    14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/messages/account_connected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been connected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/messages/account_connected_other.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account is already connected to a different account.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/messages/account_connected_updated.txt: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/messages/account_connected.txt" %} 2 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/messages/account_disconnected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been disconnected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up" %}

    9 | 10 |

    {% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{provider_name}} account to login to 11 | {{site_name}}. As a final step, please complete the following form:{% endblocktrans %}

    12 | 13 | 21 | 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/snippets/login_extra.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% providers_media_js %} 4 | -------------------------------------------------------------------------------- /09_commenting/templates/socialaccount/snippets/provider_list.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% get_providers as socialaccount_providers %} 4 | 5 | {% for provider in socialaccount_providers %} 6 | {% if provider.id == "openid" %} 7 | {% for brand in provider.get_brands %} 8 |
  • 9 | {{brand.name}} 13 |
  • 14 | {% endfor %} 15 | {% endif %} 16 |
  • 17 | {{provider.name}} 19 |
  • 20 | {% endfor %} 21 | -------------------------------------------------------------------------------- /09_commenting/templates/tests/test_403_csrf.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | Sign In 3 | -------------------------------------------------------------------------------- /10_likes/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /10_likes/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /10_likes/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/10_likes/blog/__init__.py -------------------------------------------------------------------------------- /10_likes/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /10_likes/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /10_likes/blog/forms.py: -------------------------------------------------------------------------------- 1 | from .models import Comment 2 | from django import forms 3 | 4 | 5 | class CommentForm(forms.ModelForm): 6 | class Meta: 7 | model = Comment 8 | fields = ('body',) 9 | -------------------------------------------------------------------------------- /10_likes/blog/migrations/0003_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_comment'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[('d', 'Draft'), ('p', 'Publish')], default='d'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /10_likes/blog/migrations/0004_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0003_alter_post_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /10_likes/blog/migrations/0005_auto_20210527_1517.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 15:17 2 | 3 | import cloudinary.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0004_alter_post_status'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='excerpt', 17 | field=models.TextField(blank=True), 18 | ), 19 | migrations.AddField( 20 | model_name='post', 21 | name='featured_image', 22 | field=cloudinary.models.CloudinaryField(default='media/default.jpg', max_length=255, verbose_name='image'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /10_likes/blog/migrations/0006_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:35 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0005_auto_20210527_1517'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='default', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /10_likes/blog/migrations/0007_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:39 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0006_alter_post_featured_image'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='placeholder', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /10_likes/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/10_likes/blog/migrations/__init__.py -------------------------------------------------------------------------------- /10_likes/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /10_likes/blog/urls.py: -------------------------------------------------------------------------------- 1 | from . import views 2 | from django.urls import path 3 | 4 | urlpatterns = [ 5 | path('', views.PostList.as_view(), name='home'), 6 | path('/', views.PostDetail.as_view(), name='post_detail'), 7 | path('like/', views.PostLike.as_view(), name='post_like'), 8 | ] 9 | -------------------------------------------------------------------------------- /10_likes/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/10_likes/codestar/__init__.py -------------------------------------------------------------------------------- /10_likes/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /10_likes/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path("", include("blog.urls"), name="blog-urls"), 22 | path('summernote/', include('django_summernote.urls')), 23 | path("accounts/", include("allauth.urls")), 24 | ] 25 | -------------------------------------------------------------------------------- /10_likes/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /10_likes/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/10_likes/db.sqlite3 -------------------------------------------------------------------------------- /10_likes/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', 'codestar.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 | -------------------------------------------------------------------------------- /10_likes/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-allauth==0.44.0 7 | django-summernote==0.8.11.6 8 | gunicorn==20.1.0 9 | oauthlib==3.1.1 10 | psycopg2==2.8.6 11 | PyJWT==2.1.0 12 | python3-openid==3.2.0 13 | pytz==2021.1 14 | requests-oauthlib==1.3.0 15 | sqlparse==0.4.1 16 | -------------------------------------------------------------------------------- /10_likes/templates/account/account_inactive.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Account Inactive" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Account Inactive" %}

    9 | 10 |

    {% trans "This account is inactive." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /10_likes/templates/account/email/base_message.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %} 2 | 3 | {% block content %}{% endblock %} 4 | 5 | {% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}! 6 | {{ site_domain }}{% endblocktrans %} 7 | {% endautoescape %} 8 | -------------------------------------------------------------------------------- /10_likes/templates/account/email/email_confirmation_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load account %} 3 | {% load i18n %} 4 | 5 | {% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this e-mail because user {{ user_display }} has given your e-mail address to register an account on {{ site_domain }}. 6 | 7 | To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock %} 8 | -------------------------------------------------------------------------------- /10_likes/templates/account/email/email_confirmation_signup_message.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_message.txt" %} 2 | -------------------------------------------------------------------------------- /10_likes/templates/account/email/email_confirmation_signup_subject.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_subject.txt" %} 2 | -------------------------------------------------------------------------------- /10_likes/templates/account/email/email_confirmation_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /10_likes/templates/account/email/password_reset_key_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load i18n %} 3 | 4 | {% block content %}{% autoescape off %}{% blocktrans %}You're receiving this e-mail because you or someone else has requested a password for your user account. 5 | It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %} 6 | 7 | {{ password_reset_url }}{% if username %} 8 | 9 | {% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock %} 10 | -------------------------------------------------------------------------------- /10_likes/templates/account/email/password_reset_key_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Password Reset E-mail{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /10_likes/templates/account/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Out" %}{% endblock %} 6 | 7 | {% block content %} 8 |
    9 |
    10 |
    11 |

    {% trans "Sign Out" %}

    12 | 13 |

    {% trans 'Are you sure you want to sign out?' %}

    14 |
    15 |
    16 |
    17 |
    18 | 19 |
    20 | {% csrf_token %} 21 | {% if redirect_field_value %} 22 | 23 | {% endif %} 24 | 25 |
    26 |
    27 |
    28 |
    29 | {% endblock %} -------------------------------------------------------------------------------- /10_likes/templates/account/messages/cannot_delete_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/email_confirmation_sent.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/email_confirmed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have confirmed {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/email_deleted.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/logged_in.txt: -------------------------------------------------------------------------------- 1 | {% load account %} 2 | {% load i18n %} 3 | {% user_display user as name %} 4 | {% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %} 5 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/logged_out.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have signed out.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/password_changed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully changed.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/password_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/primary_email_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Primary e-mail address set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/messages/unverified_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/account/password_change.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Change Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 | {% trans "Forgot Password?" %} 15 |
    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /10_likes/templates/account/password_reset.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 | 10 |

    {% trans "Password Reset" %}

    11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

    16 | 17 |
    18 | {% csrf_token %} 19 | {{ form.as_p }} 20 | 21 |
    22 | 23 |

    {% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

    24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /10_likes/templates/account/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 |

    {% trans "Password Reset" %}

    10 | 11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /10_likes/templates/account/password_reset_from_key.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 5 | 6 | {% block content %} 7 |

    {% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}

    8 | 9 | {% if token_fail %} 10 | {% url 'account_reset_password' as passwd_reset_url %} 11 |

    {% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a new password reset.{% endblocktrans %}

    12 | {% else %} 13 | {% if form %} 14 |
    15 | {% csrf_token %} 16 | {{ form.as_p }} 17 | 18 |
    19 | {% else %} 20 |

    {% trans 'Your password is now changed.' %}

    21 | {% endif %} 22 | {% endif %} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /10_likes/templates/account/password_reset_from_key_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 5 | 6 | {% block content %} 7 |

    {% trans "Change Password" %}

    8 |

    {% trans 'Your password is now changed.' %}

    9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /10_likes/templates/account/password_set.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Set Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Set Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 |
    15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /10_likes/templates/account/signup_closed.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up Closed" %}

    9 | 10 |

    {% trans "We are sorry, but the sign up is currently closed." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /10_likes/templates/account/snippets/already_logged_in.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load account %} 3 | 4 | {% user_display user as user_display %} 5 |

    {% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}

    6 | -------------------------------------------------------------------------------- /10_likes/templates/account/verification_sent.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 |

    {% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /10_likes/templates/account/verified_email_required.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 | {% url 'account_email' as email_url %} 11 | 12 |

    {% blocktrans %}This part of the site requires us to verify that 13 | you are who you claim to be. For this purpose, we require that you 14 | verify ownership of your e-mail address. {% endblocktrans %}

    15 | 16 |

    {% blocktrans %}We have sent an e-mail to you for 17 | verification. Please click on the link inside this e-mail. Please 18 | contact us if you do not receive it within a few minutes.{% endblocktrans %}

    19 | 20 |

    {% blocktrans %}Note: you can still change your e-mail address.{% endblocktrans %}

    21 | 22 | 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /10_likes/templates/openid/base.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | -------------------------------------------------------------------------------- /10_likes/templates/openid/login.html: -------------------------------------------------------------------------------- 1 | {% extends "openid/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}OpenID Sign In{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans 'OpenID Sign In' %}

    10 | 11 | 12 | 17 | 18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/authentication_error.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Social Network Login Failure" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Social Network Login Failure" %}

    9 | 10 |

    {% trans "An error occurred while attempting to login via your social network account." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/base.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/login_cancelled.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Login Cancelled" %}{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans "Login Cancelled" %}

    10 | 11 | {% url 'account_login' as login_url %} 12 | 13 |

    {% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to sign in.{% endblocktrans %}

    14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/messages/account_connected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been connected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/messages/account_connected_other.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account is already connected to a different account.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/messages/account_connected_updated.txt: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/messages/account_connected.txt" %} 2 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/messages/account_disconnected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been disconnected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up" %}

    9 | 10 |

    {% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{provider_name}} account to login to 11 | {{site_name}}. As a final step, please complete the following form:{% endblocktrans %}

    12 | 13 | 21 | 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/snippets/login_extra.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% providers_media_js %} 4 | -------------------------------------------------------------------------------- /10_likes/templates/socialaccount/snippets/provider_list.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% get_providers as socialaccount_providers %} 4 | 5 | {% for provider in socialaccount_providers %} 6 | {% if provider.id == "openid" %} 7 | {% for brand in provider.get_brands %} 8 |
  • 9 | {{brand.name}} 13 |
  • 14 | {% endfor %} 15 | {% endif %} 16 |
  • 17 | {{provider.name}} 19 |
  • 20 | {% endfor %} 21 | -------------------------------------------------------------------------------- /10_likes/templates/tests/test_403_csrf.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | Sign In 3 | -------------------------------------------------------------------------------- /11_messages/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /11_messages/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /11_messages/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/11_messages/blog/__init__.py -------------------------------------------------------------------------------- /11_messages/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /11_messages/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /11_messages/blog/forms.py: -------------------------------------------------------------------------------- 1 | from .models import Comment 2 | from django import forms 3 | 4 | 5 | class CommentForm(forms.ModelForm): 6 | class Meta: 7 | model = Comment 8 | fields = ('body',) 9 | -------------------------------------------------------------------------------- /11_messages/blog/migrations/0003_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_comment'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[('d', 'Draft'), ('p', 'Publish')], default='d'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /11_messages/blog/migrations/0004_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0003_alter_post_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /11_messages/blog/migrations/0005_auto_20210527_1517.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 15:17 2 | 3 | import cloudinary.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0004_alter_post_status'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='excerpt', 17 | field=models.TextField(blank=True), 18 | ), 19 | migrations.AddField( 20 | model_name='post', 21 | name='featured_image', 22 | field=cloudinary.models.CloudinaryField(default='media/default.jpg', max_length=255, verbose_name='image'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /11_messages/blog/migrations/0006_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:35 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0005_auto_20210527_1517'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='default', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /11_messages/blog/migrations/0007_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:39 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0006_alter_post_featured_image'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='placeholder', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /11_messages/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/11_messages/blog/migrations/__init__.py -------------------------------------------------------------------------------- /11_messages/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /11_messages/blog/urls.py: -------------------------------------------------------------------------------- 1 | from . import views 2 | from django.urls import path 3 | 4 | urlpatterns = [ 5 | path('', views.PostList.as_view(), name='home'), 6 | path('/', views.PostDetail.as_view(), name='post_detail'), 7 | path('like/', views.PostLike.as_view(), name='post_like'), 8 | ] 9 | -------------------------------------------------------------------------------- /11_messages/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/11_messages/codestar/__init__.py -------------------------------------------------------------------------------- /11_messages/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /11_messages/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path("", include("blog.urls"), name="blog-urls"), 22 | path('summernote/', include('django_summernote.urls')), 23 | path("accounts/", include("allauth.urls")), 24 | ] 25 | -------------------------------------------------------------------------------- /11_messages/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /11_messages/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/11_messages/db.sqlite3 -------------------------------------------------------------------------------- /11_messages/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', 'codestar.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 | -------------------------------------------------------------------------------- /11_messages/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-allauth==0.44.0 7 | django-summernote==0.8.11.6 8 | gunicorn==20.1.0 9 | oauthlib==3.1.1 10 | psycopg2==2.8.6 11 | PyJWT==2.1.0 12 | python3-openid==3.2.0 13 | pytz==2021.1 14 | requests-oauthlib==1.3.0 15 | sqlparse==0.4.1 16 | -------------------------------------------------------------------------------- /11_messages/templates/account/account_inactive.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Account Inactive" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Account Inactive" %}

    9 | 10 |

    {% trans "This account is inactive." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /11_messages/templates/account/email/base_message.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %} 2 | 3 | {% block content %}{% endblock %} 4 | 5 | {% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}! 6 | {{ site_domain }}{% endblocktrans %} 7 | {% endautoescape %} 8 | -------------------------------------------------------------------------------- /11_messages/templates/account/email/email_confirmation_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load account %} 3 | {% load i18n %} 4 | 5 | {% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this e-mail because user {{ user_display }} has given your e-mail address to register an account on {{ site_domain }}. 6 | 7 | To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock %} 8 | -------------------------------------------------------------------------------- /11_messages/templates/account/email/email_confirmation_signup_message.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_message.txt" %} 2 | -------------------------------------------------------------------------------- /11_messages/templates/account/email/email_confirmation_signup_subject.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_subject.txt" %} 2 | -------------------------------------------------------------------------------- /11_messages/templates/account/email/email_confirmation_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /11_messages/templates/account/email/password_reset_key_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load i18n %} 3 | 4 | {% block content %}{% autoescape off %}{% blocktrans %}You're receiving this e-mail because you or someone else has requested a password for your user account. 5 | It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %} 6 | 7 | {{ password_reset_url }}{% if username %} 8 | 9 | {% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock %} 10 | -------------------------------------------------------------------------------- /11_messages/templates/account/email/password_reset_key_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Password Reset E-mail{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /11_messages/templates/account/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Out" %}{% endblock %} 6 | 7 | {% block content %} 8 |
    9 |
    10 |
    11 |

    {% trans "Sign Out" %}

    12 | 13 |

    {% trans 'Are you sure you want to sign out?' %}

    14 |
    15 |
    16 |
    17 |
    18 | 19 |
    20 | {% csrf_token %} 21 | {% if redirect_field_value %} 22 | 23 | {% endif %} 24 | 25 |
    26 |
    27 |
    28 |
    29 | {% endblock %} -------------------------------------------------------------------------------- /11_messages/templates/account/messages/cannot_delete_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/email_confirmation_sent.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/email_confirmed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have confirmed {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/email_deleted.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/logged_in.txt: -------------------------------------------------------------------------------- 1 | {% load account %} 2 | {% load i18n %} 3 | {% user_display user as name %} 4 | {% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %} 5 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/logged_out.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have signed out.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/password_changed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully changed.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/password_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/primary_email_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Primary e-mail address set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/messages/unverified_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/account/password_change.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Change Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 | {% trans "Forgot Password?" %} 15 |
    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /11_messages/templates/account/password_reset.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 | 10 |

    {% trans "Password Reset" %}

    11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

    16 | 17 |
    18 | {% csrf_token %} 19 | {{ form.as_p }} 20 | 21 |
    22 | 23 |

    {% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

    24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /11_messages/templates/account/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 |

    {% trans "Password Reset" %}

    10 | 11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /11_messages/templates/account/password_reset_from_key_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 5 | 6 | {% block content %} 7 |

    {% trans "Change Password" %}

    8 |

    {% trans 'Your password is now changed.' %}

    9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /11_messages/templates/account/password_set.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Set Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Set Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 |
    15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /11_messages/templates/account/signup_closed.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up Closed" %}

    9 | 10 |

    {% trans "We are sorry, but the sign up is currently closed." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /11_messages/templates/account/snippets/already_logged_in.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load account %} 3 | 4 | {% user_display user as user_display %} 5 |

    {% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}

    6 | -------------------------------------------------------------------------------- /11_messages/templates/account/verification_sent.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 |

    {% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /11_messages/templates/account/verified_email_required.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 | {% url 'account_email' as email_url %} 11 | 12 |

    {% blocktrans %}This part of the site requires us to verify that 13 | you are who you claim to be. For this purpose, we require that you 14 | verify ownership of your e-mail address. {% endblocktrans %}

    15 | 16 |

    {% blocktrans %}We have sent an e-mail to you for 17 | verification. Please click on the link inside this e-mail. Please 18 | contact us if you do not receive it within a few minutes.{% endblocktrans %}

    19 | 20 |

    {% blocktrans %}Note: you can still change your e-mail address.{% endblocktrans %}

    21 | 22 | 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /11_messages/templates/openid/base.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | -------------------------------------------------------------------------------- /11_messages/templates/openid/login.html: -------------------------------------------------------------------------------- 1 | {% extends "openid/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}OpenID Sign In{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans 'OpenID Sign In' %}

    10 | 11 | 12 | 17 | 18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/authentication_error.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Social Network Login Failure" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Social Network Login Failure" %}

    9 | 10 |

    {% trans "An error occurred while attempting to login via your social network account." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/base.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/login_cancelled.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Login Cancelled" %}{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans "Login Cancelled" %}

    10 | 11 | {% url 'account_login' as login_url %} 12 | 13 |

    {% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to sign in.{% endblocktrans %}

    14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/messages/account_connected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been connected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/messages/account_connected_other.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account is already connected to a different account.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/messages/account_connected_updated.txt: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/messages/account_connected.txt" %} 2 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/messages/account_disconnected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been disconnected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up" %}

    9 | 10 |

    {% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{provider_name}} account to login to 11 | {{site_name}}. As a final step, please complete the following form:{% endblocktrans %}

    12 | 13 | 21 | 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/snippets/login_extra.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% providers_media_js %} 4 | -------------------------------------------------------------------------------- /11_messages/templates/socialaccount/snippets/provider_list.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% get_providers as socialaccount_providers %} 4 | 5 | {% for provider in socialaccount_providers %} 6 | {% if provider.id == "openid" %} 7 | {% for brand in provider.get_brands %} 8 |
  • 9 | {{brand.name}} 13 |
  • 14 | {% endfor %} 15 | {% endif %} 16 |
  • 17 | {{provider.name}} 19 |
  • 20 | {% endfor %} 21 | -------------------------------------------------------------------------------- /11_messages/templates/tests/test_403_csrf.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | Sign In 3 | -------------------------------------------------------------------------------- /12_final_deployment/.gitignore: -------------------------------------------------------------------------------- 1 | core.Microsoft* 2 | core.mongo* 3 | core.python* 4 | env.py 5 | __pycache__/ 6 | *.py[cod] 7 | node_modules/ 8 | -------------------------------------------------------------------------------- /12_final_deployment/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn codestar.wsgi -------------------------------------------------------------------------------- /12_final_deployment/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/12_final_deployment/blog/__init__.py -------------------------------------------------------------------------------- /12_final_deployment/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post, Comment 3 | from django_summernote.admin import SummernoteModelAdmin 4 | 5 | 6 | @admin.register(Post) 7 | class PostAdmin(SummernoteModelAdmin): 8 | 9 | list_display = ('title', 'slug', 'status', 'created_on') 10 | search_fields = ['title', 'content'] 11 | list_filter = ('status', 'created_on') 12 | prepopulated_fields = {'slug': ('title',)} 13 | summernote_fields = ('content',) 14 | 15 | 16 | @admin.register(Comment) 17 | class CommentAdmin(admin.ModelAdmin): 18 | list_display = ('name', 'body', 'post', 'created_on', 'approved') 19 | list_filter = ('approved', 'created_on') 20 | search_fields = ('name', 'email', 'body') 21 | actions = ['approve_comments'] 22 | 23 | def approve_comments(self, request, queryset): 24 | queryset.update(approved=True) 25 | -------------------------------------------------------------------------------- /12_final_deployment/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'blog' 7 | -------------------------------------------------------------------------------- /12_final_deployment/blog/forms.py: -------------------------------------------------------------------------------- 1 | from .models import Comment 2 | from django import forms 3 | 4 | 5 | class CommentForm(forms.ModelForm): 6 | class Meta: 7 | model = Comment 8 | fields = ('body',) 9 | -------------------------------------------------------------------------------- /12_final_deployment/blog/migrations/0003_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 08:18 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0002_comment'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[('d', 'Draft'), ('p', 'Publish')], default='d'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /12_final_deployment/blog/migrations/0004_alter_post_status.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 10:31 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0003_alter_post_status'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='status', 16 | field=models.IntegerField(choices=[(0, 'Draft'), (1, 'Published')], default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /12_final_deployment/blog/migrations/0005_auto_20210527_1517.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-27 15:17 2 | 3 | import cloudinary.models 4 | from django.db import migrations, models 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0004_alter_post_status'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AddField( 15 | model_name='post', 16 | name='excerpt', 17 | field=models.TextField(blank=True), 18 | ), 19 | migrations.AddField( 20 | model_name='post', 21 | name='featured_image', 22 | field=cloudinary.models.CloudinaryField(default='media/default.jpg', max_length=255, verbose_name='image'), 23 | ), 24 | ] 25 | -------------------------------------------------------------------------------- /12_final_deployment/blog/migrations/0006_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:35 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0005_auto_20210527_1517'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='default', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /12_final_deployment/blog/migrations/0007_alter_post_featured_image.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.3 on 2021-05-28 08:39 2 | 3 | import cloudinary.models 4 | from django.db import migrations 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | dependencies = [ 10 | ('blog', '0006_alter_post_featured_image'), 11 | ] 12 | 13 | operations = [ 14 | migrations.AlterField( 15 | model_name='post', 16 | name='featured_image', 17 | field=cloudinary.models.CloudinaryField(default='placeholder', max_length=255, verbose_name='image'), 18 | ), 19 | ] 20 | -------------------------------------------------------------------------------- /12_final_deployment/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/12_final_deployment/blog/migrations/__init__.py -------------------------------------------------------------------------------- /12_final_deployment/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /12_final_deployment/blog/urls.py: -------------------------------------------------------------------------------- 1 | from . import views 2 | from django.urls import path 3 | 4 | urlpatterns = [ 5 | path('', views.PostList.as_view(), name='home'), 6 | path('/', views.PostDetail.as_view(), name='post_detail'), 7 | path('like/', views.PostLike.as_view(), name='post_like'), 8 | ] 9 | -------------------------------------------------------------------------------- /12_final_deployment/codestar/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/12_final_deployment/codestar/__init__.py -------------------------------------------------------------------------------- /12_final_deployment/codestar/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /12_final_deployment/codestar/urls.py: -------------------------------------------------------------------------------- 1 | """codestar URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path("", include("blog.urls"), name="blog-urls"), 22 | path('summernote/', include('django_summernote.urls')), 23 | path("accounts/", include("allauth.urls")), 24 | ] 25 | -------------------------------------------------------------------------------- /12_final_deployment/codestar/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for codestar 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', 'codestar.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /12_final_deployment/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code-Institute-Solutions/Django3blog/75bd87f4439d678bee07c149383cf2d778c38a6f/12_final_deployment/db.sqlite3 -------------------------------------------------------------------------------- /12_final_deployment/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', 'codestar.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 | -------------------------------------------------------------------------------- /12_final_deployment/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.3.4 2 | cloudinary==1.25.0 3 | dj-database-url==0.5.0 4 | dj3-cloudinary-storage==0.0.5 5 | Django==3.2.3 6 | django-allauth==0.44.0 7 | django-crispy-forms==1.11.2 8 | django-summernote==0.8.11.6 9 | gunicorn==20.1.0 10 | oauthlib==3.1.1 11 | psycopg2==2.8.6 12 | PyJWT==2.1.0 13 | python3-openid==3.2.0 14 | pytz==2021.1 15 | requests-oauthlib==1.3.0 16 | sqlparse==0.4.1 17 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/account_inactive.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Account Inactive" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Account Inactive" %}

    9 | 10 |

    {% trans "This account is inactive." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/email/base_message.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %} 2 | 3 | {% block content %}{% endblock %} 4 | 5 | {% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}! 6 | {{ site_domain }}{% endblocktrans %} 7 | {% endautoescape %} 8 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/email/email_confirmation_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load account %} 3 | {% load i18n %} 4 | 5 | {% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this e-mail because user {{ user_display }} has given your e-mail address to register an account on {{ site_domain }}. 6 | 7 | To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock %} 8 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/email/email_confirmation_signup_message.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_message.txt" %} 2 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/email/email_confirmation_signup_subject.txt: -------------------------------------------------------------------------------- 1 | {% include "account/email/email_confirmation_subject.txt" %} 2 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/email/email_confirmation_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/email/password_reset_key_message.txt: -------------------------------------------------------------------------------- 1 | {% extends "account/email/base_message.txt" %} 2 | {% load i18n %} 3 | 4 | {% block content %}{% autoescape off %}{% blocktrans %}You're receiving this e-mail because you or someone else has requested a password for your user account. 5 | It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %} 6 | 7 | {{ password_reset_url }}{% if username %} 8 | 9 | {% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock %} 10 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/email/password_reset_key_subject.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% autoescape off %} 3 | {% blocktrans %}Password Reset E-mail{% endblocktrans %} 4 | {% endautoescape %} 5 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Out" %}{% endblock %} 6 | 7 | {% block content %} 8 |
    9 |
    10 |
    11 |

    {% trans "Sign Out" %}

    12 | 13 |

    {% trans 'Are you sure you want to sign out?' %}

    14 |
    15 |
    16 |
    17 |
    18 | 19 |
    20 | {% csrf_token %} 21 | {% if redirect_field_value %} 22 | 23 | {% endif %} 24 | 25 |
    26 |
    27 |
    28 |
    29 | {% endblock %} -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/cannot_delete_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/email_confirmation_sent.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/email_confirmed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have confirmed {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/email_deleted.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/logged_in.txt: -------------------------------------------------------------------------------- 1 | {% load account %} 2 | {% load i18n %} 3 | {% user_display user as name %} 4 | {% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %} 5 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/logged_out.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}You have signed out.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/password_changed.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully changed.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/password_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Password successfully set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/primary_email_set.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Primary e-mail address set.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/messages/unverified_primary_email.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/password_change.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Change Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 | {% trans "Forgot Password?" %} 15 |
    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/password_reset.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 | 10 |

    {% trans "Password Reset" %}

    11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

    16 | 17 |
    18 | {% csrf_token %} 19 | {{ form.as_p }} 20 | 21 |
    22 | 23 |

    {% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

    24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/password_reset_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Password Reset" %}{% endblock %} 7 | 8 | {% block content %} 9 |

    {% trans "Password Reset" %}

    10 | 11 | {% if user.is_authenticated %} 12 | {% include "account/snippets/already_logged_in.html" %} 13 | {% endif %} 14 | 15 |

    {% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    16 | {% endblock %} 17 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/password_reset_from_key_done.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% block head_title %}{% trans "Change Password" %}{% endblock %} 5 | 6 | {% block content %} 7 |

    {% trans "Change Password" %}

    8 |

    {% trans 'Your password is now changed.' %}

    9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/password_set.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Set Password" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Set Password" %}

    9 | 10 |
    11 | {% csrf_token %} 12 | {{ form.as_p }} 13 | 14 |
    15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/signup_closed.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up Closed" %}

    9 | 10 |

    {% trans "We are sorry, but the sign up is currently closed." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/snippets/already_logged_in.html: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% load account %} 3 | 4 | {% user_display user as user_display %} 5 |

    {% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}

    6 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/verification_sent.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 |

    {% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

    11 | 12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /12_final_deployment/templates/account/verified_email_required.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Verify Your E-mail Address" %}

    9 | 10 | {% url 'account_email' as email_url %} 11 | 12 |

    {% blocktrans %}This part of the site requires us to verify that 13 | you are who you claim to be. For this purpose, we require that you 14 | verify ownership of your e-mail address. {% endblocktrans %}

    15 | 16 |

    {% blocktrans %}We have sent an e-mail to you for 17 | verification. Please click on the link inside this e-mail. Please 18 | contact us if you do not receive it within a few minutes.{% endblocktrans %}

    19 | 20 |

    {% blocktrans %}Note: you can still change your e-mail address.{% endblocktrans %}

    21 | 22 | 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /12_final_deployment/templates/openid/base.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | -------------------------------------------------------------------------------- /12_final_deployment/templates/openid/login.html: -------------------------------------------------------------------------------- 1 | {% extends "openid/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}OpenID Sign In{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans 'OpenID Sign In' %}

    10 | 11 | 12 | 17 | 18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/authentication_error.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Social Network Login Failure" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Social Network Login Failure" %}

    9 | 10 |

    {% trans "An error occurred while attempting to login via your social network account." %}

    11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/base.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/login_cancelled.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Login Cancelled" %}{% endblock %} 6 | 7 | {% block content %} 8 | 9 |

    {% trans "Login Cancelled" %}

    10 | 11 | {% url 'account_login' as login_url %} 12 | 13 |

    {% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to sign in.{% endblocktrans %}

    14 | 15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/messages/account_connected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been connected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/messages/account_connected_other.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account is already connected to a different account.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/messages/account_connected_updated.txt: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/messages/account_connected.txt" %} 2 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/messages/account_disconnected.txt: -------------------------------------------------------------------------------- 1 | {% load i18n %} 2 | {% blocktrans %}The social account has been disconnected.{% endblocktrans %} 3 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |

    {% trans "Sign Up" %}

    9 | 10 |

    {% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{provider_name}} account to login to 11 | {{site_name}}. As a final step, please complete the following form:{% endblocktrans %}

    12 | 13 | 21 | 22 | {% endblock %} 23 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/snippets/login_extra.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% providers_media_js %} 4 | -------------------------------------------------------------------------------- /12_final_deployment/templates/socialaccount/snippets/provider_list.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | 3 | {% get_providers as socialaccount_providers %} 4 | 5 | {% for provider in socialaccount_providers %} 6 | {% if provider.id == "openid" %} 7 | {% for brand in provider.get_brands %} 8 |
  • 9 | {{brand.name}} 13 |
  • 14 | {% endfor %} 15 | {% endif %} 16 |
  • 17 | {{provider.name}} 19 |
  • 20 | {% endfor %} 21 | -------------------------------------------------------------------------------- /12_final_deployment/templates/tests/test_403_csrf.html: -------------------------------------------------------------------------------- 1 | {% load socialaccount %} 2 | Sign In 3 | --------------------------------------------------------------------------------