├── README.md ├── I4G012183RIR ├── blog │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-310.pyc │ │ │ └── 0001_initial.cpython-310.pyc │ │ └── 0001_initial.py │ ├── tests.py │ ├── __pycache__ │ │ ├── apps.cpython-310.pyc │ │ ├── urls.cpython-310.pyc │ │ ├── admin.cpython-310.pyc │ │ ├── models.cpython-310.pyc │ │ ├── views.cpython-310.pyc │ │ └── __init__.cpython-310.pyc │ ├── admin.py │ ├── apps.py │ ├── urls.py │ ├── templates │ │ ├── blog │ │ │ ├── post_detail.html │ │ │ ├── post_form.html │ │ │ ├── post_confirm_delete.html │ │ │ └── post_list.html │ │ └── base.html │ ├── views.py │ └── models.py ├── I4G012183RIR │ ├── __init__.py │ ├── __pycache__ │ │ ├── urls.cpython-310.pyc │ │ ├── wsgi.cpython-310.pyc │ │ ├── __init__.cpython-310.pyc │ │ └── settings.cpython-310.pyc │ ├── asgi.py │ ├── wsgi.py │ ├── urls.py │ └── settings.py ├── db.sqlite3 └── manage.py ├── LICENSE └── .gitignore /README.md: -------------------------------------------------------------------------------- 1 | # DjangoCRUD -------------------------------------------------------------------------------- /I4G012183RIR/blog/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /I4G012183RIR/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/db.sqlite3 -------------------------------------------------------------------------------- /I4G012183RIR/blog/__pycache__/apps.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/__pycache__/apps.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/blog/__pycache__/urls.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/__pycache__/urls.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/blog/__pycache__/admin.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/__pycache__/admin.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/blog/__pycache__/models.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/__pycache__/models.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/blog/__pycache__/views.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/__pycache__/views.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/blog/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Post 3 | 4 | # Register your models here. 5 | admin.site.register(Post) 6 | -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/__pycache__/urls.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/I4G012183RIR/__pycache__/urls.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/__pycache__/wsgi.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/I4G012183RIR/__pycache__/wsgi.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/I4G012183RIR/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/__pycache__/settings.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/I4G012183RIR/__pycache__/settings.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/blog/migrations/__pycache__/__init__.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/migrations/__pycache__/__init__.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/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 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/migrations/__pycache__/0001_initial.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Davidevlops/DjangoCRUD/HEAD/I4G012183RIR/blog/migrations/__pycache__/0001_initial.cpython-310.pyc -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for I4G012183RIR 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/4.0/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', 'I4G012183RIR.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for I4G012183RIR 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/4.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'I4G012183RIR.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | from . import views 3 | 4 | app_name = "blog" 5 | 6 | urlpatterns = [ 7 | path("", views.PostListView.as_view(), name="all"), 8 | path("create/", views.PostCreateView.as_view(), name="post_create"), 9 | path("delete/", views.PostDeleteView.as_view(), name="post_delete"), 10 | path("update/", views.PostUpdateView.as_view(), name="post_update"), 11 | path("read/", views.PostDetailView.as_view(), name="post_detail"), 12 | 13 | ] 14 | -------------------------------------------------------------------------------- /I4G012183RIR/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', 'I4G012183RIR.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 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/templates/blog/post_detail.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block content %} 4 | 5 |
6 |
7 |

{{object.title}}

8 |
9 |
10 |
11 |

{{object.body|linebreaks}}

12 |
13 |
14 |
Author: {{object.author}}
15 | Published: {{object.publish|date:"D, d M, y"}} 16 |
17 |
18 | BACK 19 |
20 |
21 |
22 | 23 | {% endblock %} -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/urls.py: -------------------------------------------------------------------------------- 1 | """I4G012183RIR URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/4.0/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 | 20 | urlpatterns = [ 21 | path('admin/', admin.site.urls), 22 | path("blog/", include("blog.urls", namespace="blog")) 23 | ] 24 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | from django.views.generic.edit import CreateView 3 | from django.views.generic.list import ListView 4 | from django.views.generic.detail import DetailView 5 | from django.views.generic.edit import UpdateView 6 | from django.urls import reverse_lazy 7 | 8 | from .models import Post 9 | 10 | # Create your views here. 11 | 12 | 13 | class PostListView(ListView): 14 | model = Post 15 | template_name ="base.html" 16 | 17 | 18 | class PostCreateView(CreateView): 19 | model = Post 20 | fields = "__all__" 21 | success_url = reverse_lazy("blog: all") 22 | 23 | 24 | class PostDetailView(DetailView): 25 | model = Post 26 | 27 | 28 | class PostUpdateView(UpdateView): 29 | model = Post 30 | fields = "__all__" 31 | success_url = reverse_lazy("blog: all") 32 | 33 | 34 | 35 | class PostDeleteView(UpdateView): 36 | model = Post 37 | fields = "__all__" 38 | success_url = reverse_lazy("blog: all") 39 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/templates/blog/post_form.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} 2 | 3 | 4 | 5 |
6 |
7 |
8 | {% csrf_token %} 9 | 10 | {{form.as_table}} 11 |
12 |
13 | 19 | 26 |
27 |
28 |
29 |
30 | 31 | 32 | 33 | {% endblock %} 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 David 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/templates/blog/post_confirm_delete.html: -------------------------------------------------------------------------------- 1 | {% extends "base.html" %} {% block content %} {% url 'blog:all' as list_all %} 2 | 3 |
4 |
5 |

Delete Film

6 | 7 |

Are you sure you want to delete the Post:

8 |

{{ object.title }}

9 |
10 | {% csrf_token %} {% comment %} 11 | 16 | {% endcomment %} 17 | 23 | 30 |
31 |
32 |
33 | 34 | {% endblock %} 35 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth import get_user_model 3 | from django.utils import timezone 4 | from django.urls import reverse 5 | from django.template.defaultfilters import slugify 6 | # Create your models here. 7 | 8 | 9 | class Post(models.Model): 10 | 11 | STATUS_CHOICES = ( 12 | ("draft", "Draft"), 13 | ("published", "Published") 14 | ) 15 | 16 | # DB Fields 17 | title = models.CharField(max_length=250) 18 | slug = models.SlugField(max_length=300, unique=True, editable=False) 19 | author = models.ForeignKey( 20 | get_user_model(), on_delete=models.CASCADE, related_name="blog_posts" 21 | ) 22 | body = models.TextField() 23 | 24 | publish = models.DateTimeField(default=timezone.now) 25 | created = models.DateTimeField(auto_now_add=True) 26 | updated = models.DateTimeField(auto_now=True) 27 | 28 | status = models.CharField( 29 | max_length=10, choices=STATUS_CHOICES, default="draft" 30 | ) 31 | 32 | class Meta: 33 | ordering = ("-publish",) 34 | 35 | def save(self, *args, **kwargs): 36 | self.slug = slugify(self.title) 37 | super().save(*args, **kwargs) 38 | pass 39 | 40 | def __str__(self): 41 | return self.title 42 | 43 | def get_absolute_url(self): 44 | return reverse("blog:post_detail", kwargs={"slug": self.slug}) 45 | 46 | 47 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.5 on 2022-06-23 11:03 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | import django.utils.timezone 7 | 8 | 9 | class Migration(migrations.Migration): 10 | 11 | initial = True 12 | 13 | dependencies = [ 14 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 15 | ] 16 | 17 | operations = [ 18 | migrations.CreateModel( 19 | name='Post', 20 | fields=[ 21 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 22 | ('title', models.CharField(max_length=250)), 23 | ('slug', models.SlugField(editable=False, max_length=300, unique=True)), 24 | ('body', models.TextField()), 25 | ('publish', models.DateTimeField(default=django.utils.timezone.now)), 26 | ('created', models.DateTimeField(auto_now_add=True)), 27 | ('updated', models.DateTimeField(auto_now=True)), 28 | ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published')], default='draft', max_length=10)), 29 | ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blog_posts', to=settings.AUTH_USER_MODEL)), 30 | ], 31 | options={ 32 | 'ordering': ('-publish',), 33 | }, 34 | ), 35 | ] 36 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | {% block title %} {% if title %} 15 | {{title}} | My Blog ✏ 16 | {% else %} 17 | My Blog Posts 📝 18 | {% endif %} {% endblock title %} {% block head %} {% endblock head %} 19 | 20 | 21 | 22 |
23 | 24 | 25 | 46 | 47 | 48 |
49 | 50 | {% block content %} {% endblock content %} 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /I4G012183RIR/blog/templates/blog/post_list.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} {% block content %} {% for film in film_list %} {% for 2 | colname in film.column_set.all %} 3 |

{{colname}}

4 | {% endfor %} {% endfor %} 5 | 6 |
7 |
8 |

My Films

9 | 10 | 11 | 12 | {% comment %} 13 | 14 | {% endcomment %} 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {% for post in post_list %} 27 | 28 | {% comment %} 29 | 30 | {% endcomment %} 31 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | {% endfor %} 42 | 43 |
#TitleAuthorSummaryStatusDate PublishedDate Created
{{forloop.counter}} 32 | {{post.title}} 33 | {{post.author}}{{post.body|truncatewords:30|linebreaks}}{{post.status}}{{post.published_at|date:"D, d M, y"}}UpdateDelete
44 |
45 | Add New 50 |
51 |
52 |
53 | 54 | {% endblock content %} 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /I4G012183RIR/I4G012183RIR/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for I4G012183RIR project. 3 | 4 | Generated by 'django-admin startproject' using Django 4.0.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/4.0/ref/settings/ 11 | """ 12 | import os 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'SECRET_KEY' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = 'DEBUG' 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'blog' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'I4G012183RIR.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, "templates")], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'I4G012183RIR.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/4.0/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': BASE_DIR / 'db.sqlite3', 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/4.0/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_TZ = True 114 | 115 | 116 | # Static files (CSS, JavaScript, Images) 117 | # https://docs.djangoproject.com/en/4.0/howto/static-files/ 118 | 119 | STATIC_URL = 'static/' 120 | 121 | # Default primary key field type 122 | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field 123 | 124 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 125 | --------------------------------------------------------------------------------