{% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}
6 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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('{% trans "This account is inactive." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "This account is inactive." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "This account is inactive." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "This account is inactive." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 'Your password is now changed.' %}
9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /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 "This account is inactive." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 'Your password is now changed.' %}
9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /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 'Your password is now changed.' %}
9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /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 'Your password is now changed.' %}
9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /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 "We are sorry, but the sign up is currently closed." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "We are sorry, but the sign up is currently closed." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 'Your password is now changed.' %}
9 | {% endblock %} 10 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 "We are sorry, but the sign up is currently closed." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "We are sorry, but the sign up is currently closed." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "We are sorry, but the sign up is currently closed." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 "An error occurred while attempting to login via your social network account." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 "An error occurred while attempting to login via your social network account." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "An error occurred while attempting to login via your social network account." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "An error occurred while attempting to login via your social network account." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /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 "An error occurred while attempting to login via your social network account." %}
11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 |{% 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/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 |{% 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/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 |{% 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/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 |{% 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/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/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 |{% 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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 |{% 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/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/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 | -------------------------------------------------------------------------------- /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 |{% 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/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_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/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 |{% 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 |{% 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/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_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/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 |{% 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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 |{% 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_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 |{% 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_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 |{% 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_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 |{% 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_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 |{% 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/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/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/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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 |{% 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 |{% 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/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |{% 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/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |{% 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/signup.html: -------------------------------------------------------------------------------- 1 | {% extends "socialaccount/base.html" %} 2 | 3 | {% load i18n %} 4 | 5 | {% block head_title %}{% trans "Signup" %}{% endblock %} 6 | 7 | {% block content %} 8 |{% 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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 |{% 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 |{% 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/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 |{% trans 'Are you sure you want to sign out?' %}
14 |{% 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 | 22 | 23 |{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}
24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /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 |{% trans 'Are you sure you want to sign out?' %}
14 |{% 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/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 |{% trans 'Are you sure you want to sign out?' %}
14 |{% 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/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 |{% trans 'Are you sure you want to sign out?' %}
14 |{% 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 | 22 | 23 |{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}
24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /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 "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}
16 | 17 | 22 | 23 |{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}
24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /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 "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}
16 | 17 | 22 | 23 |{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}
24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /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 |{% trans 'Are you sure you want to sign out?' %}
14 |{% 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 | 22 | 23 |{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}
24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /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 |{% 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | ) -------------------------------------------------------------------------------- /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 | ) -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 |{% 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 | 19 | {% else %} 20 |{% trans 'Your password is now changed.' %}
21 | {% endif %} 22 | {% endif %} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /09_commenting/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 |{% 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 | 19 | {% else %} 20 |{% trans 'Your password is now changed.' %}
21 | {% endif %} 22 | {% endif %} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /11_messages/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 |{% 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 | 19 | {% else %} 20 |{% trans 'Your password is now changed.' %}
21 | {% endif %} 22 | {% endif %} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /08_authorisation/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 |{% 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 | 19 | {% else %} 20 |{% trans 'Your password is now changed.' %}
21 | {% endif %} 22 | {% endif %} 23 | {% endblock %} 24 | -------------------------------------------------------------------------------- /10_likes/templates/account/email_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends "account/base.html" %} 2 | 3 | {% load i18n %} 4 | {% load account %} 5 | 6 | {% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %} 7 | 8 | 9 | {% block content %} 10 |{% blocktrans with confirmation.email_address.email as email %}Please confirm that {{ email }} is an e-mail address for user {{ user_display }}.{% endblocktrans %}
17 | 18 | 22 | 23 | {% else %} 24 | 25 | {% url 'account_email' as email_url %} 26 | 27 |{% blocktrans %}This e-mail confirmation link expired or is invalid. Please issue a new e-mail confirmation request.{% endblocktrans %}
28 | 29 | {% endif %} 30 | 31 | {% endblock %} 32 | --------------------------------------------------------------------------------