From 24ea7bb59b9218de80933144a987970e8742083f Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 12:08:19 +0200
Subject: [PATCH 01/10] chore: added django project for blog
---
.../mysite/blog/__init__.py | 0
.../M1 - Django Learning/mysite/blog/admin.py | 3 +
.../M1 - Django Learning/mysite/blog/apps.py | 6 +
.../mysite/blog/migrations/__init__.py | 0
.../mysite/blog/models.py | 3 +
.../M1 - Django Learning/mysite/blog/tests.py | 3 +
.../M1 - Django Learning/mysite/blog/views.py | 3 +
.../M1 - Django Learning/mysite/db.sqlite3 | Bin 0 -> 131072 bytes
.../M1 - Django Learning/mysite/manage.py | 22 ++++
.../mysite/mysite/__init__.py | 0
.../mysite/mysite/asgi.py | 16 +++
.../mysite/mysite/settings.py | 122 ++++++++++++++++++
.../mysite/mysite/urls.py | 22 ++++
.../mysite/mysite/wsgi.py | 16 +++
14 files changed, 216 insertions(+)
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/__init__.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/apps.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/migrations/__init__.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/tests.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3
create mode 100755 Projects/Testtrack/M1 - Django Learning/mysite/manage.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/mysite/__init__.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/mysite/asgi.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/mysite/settings.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/mysite/wsgi.py
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/__init__.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/apps.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/apps.py
new file mode 100644
index 0000000..94788a5
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class BlogConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'blog'
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/migrations/__init__.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/tests.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3 b/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..7b9ab03361cc267d0d0f6bf6d625e68718ec7c0a
GIT binary patch
literal 131072
zcmeI5Yit`=cE>p)MT(Nh(Zlk%n>ZTLQDUyFh;NEcw;RP~Y&EtV%W@L|4W>hKB-7zT
zCMiDLVy6m8M&w%8QtV~h4v+6A^-wAkGb
z+W0o|k0V
zzMuDgYv|*lE5heJU+?E=(EaUCPX(m67KL`RTq|jJ)!o(&Ww)s{lO=O7Q}L@m@eiL8duh1
zJY_^-mEU93$D>7jPZ1V^O$UizmFjdWh
zt!gYL#d@u!)mlpH-j2qaRAMWY&1k6tuNu=%bg2{bsM61iMYn0q+K;0E$-EW{NcR?m
zJ<+TZvq;YgiuICKQ>&U1i>rlXHm#bqVU`N_uLjd-K-U9DLN(A47m4n@F&>asR)qU6
zw$wsJzfSqp&ljeMrrEbRkA#dMHdbD~l(+ULPD6&3Iuf}|6}qi8$mQky+6GDGPFzc^=U>UM=hx2VuUSrNoFgiqXGhn$q}8?6
zjn$P)mo|-^`SU%Euvb%$caz0n=ZNmb#sbpfqHurOftFuk7NGj}ct4E#;l~P|-bV~p
zE8KQKWbb@37?5UXh4)U`k#!s2Xdg(2qO+qmn|JCBYLU0qM)8K)I2}(cN4w3E8c9WM
zwveg1TNIIexTjkrN(y5$jqY;A-uFDJgQFTBfO)ql!{u=DoT}}L@G))Qz#`%
z$pU{2aVaotz_hV!GAZos@)~z3>9WgbuXz`X
zhfw=*D{>NSs&}uIZcOfnqpuD5S<~L+aT@()Q@gdR)ry*9(`$>*aqu*|2G3B*XnRu#
zNJ~q?o@!-REpIo}7JC^pxR^VJY#}7q~xS02yMB0AivG*6wqg1p~?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iDQ&5kxo78VLCdg+xVg_1e$^oc?eT5!uI}$
zw|aA2;Gs;xmhA=+gom1)$Y-QD%T
zlS!yjIvyg?y?Hsn1_tg6X18IU+Cg#HkZbKgOyfgcJIemL5mIBA`0X~8AsdLUS#zT3brjw)bjI6^h!jR&Yvt>Hulh3S(2#iiV&55*;NX(RY6GDLzT)GfUQ%
z(3R>`^o(m8=$ap@0n`gOwPK6UP|zQ+^qZowyP@sSAZllVOu})!vZ*8WnzB_>iS^|AI7Z7&}WNJR=}^Pph3N4jLx
zTv}60amx&BXWTzDa2QUXg9KodA?bH!Xv%GHMc7*!RJ$#BC7x0!3m
z00ck)1V8`;KmY_l00cnbF(QEX|Hr5@AO!?K00ck)1V8`;KmY_l00ck)1RfCqy#GHU
zuy6|kAOHd&00JNY0w4eaAOHd&00NH@0lfb|MwJ06AOHd&00JNY0w4eaAOHd&00JQJ
zhzNwpuU~xMBYs=_2k|e(KNdfr4g7!r2!H?xfB*=900@8p2!H?xfB*)wvmw5*T&e4d#Z_GbdvpEL-0X-i^T{I~m04bkQt+cf_U
z!KC2xNGJK9F`+*hqt#lCd+hz+Gx3N*f?E&(0T2KI5C8!X009sH0T2KI5CDP4f`DcI
zzxY@Pf(Q@*0T2KI5C8!X009sH0T2KI5CDOPPQdd1|ImHIAqao~2!H?xfB*=900@8p
O2!H?xfWYHH;Qs*f^`Eo=
literal 0
HcmV?d00001
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/manage.py b/Projects/Testtrack/M1 - Django Learning/mysite/manage.py
new file mode 100755
index 0000000..a7da667
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/mysite/__init__.py b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/mysite/asgi.py b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/asgi.py
new file mode 100644
index 0000000..4e0d84c
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/asgi.py
@@ -0,0 +1,16 @@
+"""
+ASGI config for mysite project.
+
+It exposes the ASGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
+"""
+
+import os
+
+from django.core.asgi import get_asgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
+
+application = get_asgi_application()
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/mysite/settings.py b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/settings.py
new file mode 100644
index 0000000..e3b72ab
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/settings.py
@@ -0,0 +1,122 @@
+"""
+Django settings for mysite project.
+
+Generated by 'django-admin startproject' using Django 5.2.7.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.2/topics/settings/
+
+For the full list of settings and their values, see
+https://docs.djangoproject.com/en/5.2/ref/settings/
+"""
+
+from pathlib import Path
+
+# Build paths inside the project like this: BASE_DIR / 'subdir'.
+BASE_DIR = Path(__file__).resolve().parent.parent
+
+
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
+
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'django-insecure-s8afcv8t5jbc6znt!wx*ylmq!%-l$!-*6hcqisns_7i201hfuq'
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = True
+
+ALLOWED_HOSTS = []
+
+
+# Application definition
+
+INSTALLED_APPS = [
+ 'django.contrib.admin',
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.messages',
+ 'django.contrib.staticfiles',
+]
+
+MIDDLEWARE = [
+ 'django.middleware.security.SecurityMiddleware',
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+]
+
+ROOT_URLCONF = 'mysite.urls'
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+]
+
+WSGI_APPLICATION = 'mysite.wsgi.application'
+
+
+# Database
+# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': BASE_DIR / 'db.sqlite3',
+ }
+}
+
+
+# Password validation
+# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
+
+AUTH_PASSWORD_VALIDATORS = [
+ {
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
+ },
+ {
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
+ },
+]
+
+
+# Internationalization
+# https://docs.djangoproject.com/en/5.2/topics/i18n/
+
+LANGUAGE_CODE = 'en-us'
+
+TIME_ZONE = 'UTC'
+
+USE_I18N = True
+
+USE_TZ = True
+
+
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/5.2/howto/static-files/
+
+STATIC_URL = 'static/'
+
+# Default primary key field type
+# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
+
+DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py
new file mode 100644
index 0000000..3d1f1da
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py
@@ -0,0 +1,22 @@
+"""
+URL configuration for mysite project.
+
+The `urlpatterns` list routes URLs to views. For more information please see:
+ https://docs.djangoproject.com/en/5.2/topics/http/urls/
+Examples:
+Function views
+ 1. Add an import: from my_app import views
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
+Class-based views
+ 1. Add an import: from other_app.views import Home
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
+Including another URLconf
+ 1. Import the include() function: from django.urls import include, path
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
+"""
+from django.contrib import admin
+from django.urls import path
+
+urlpatterns = [
+ path('admin/', admin.site.urls),
+]
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/mysite/wsgi.py b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/wsgi.py
new file mode 100644
index 0000000..35e1b4d
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/wsgi.py
@@ -0,0 +1,16 @@
+"""
+WSGI config for mysite project.
+
+It exposes the WSGI callable as a module-level variable named ``application``.
+
+For more information on this file, see
+https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
+"""
+
+import os
+
+from django.core.wsgi import get_wsgi_application
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
+
+application = get_wsgi_application()
From 2bfc32ebbd39abdd120292fce3eb8176af54c829 Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 12:37:48 +0200
Subject: [PATCH 02/10] feat: added Post model and migration
---
.../mysite/blog/migrations/0001_initial.py | 40 ++++++++++++++++++
.../mysite/blog/models.py | 32 +++++++++++++-
.../M1 - Django Learning/mysite/db.sqlite3 | Bin 131072 -> 147456 bytes
.../mysite/mysite/settings.py | 1 +
4 files changed, 72 insertions(+), 1 deletion(-)
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/migrations/0001_initial.py
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/migrations/0001_initial.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/migrations/0001_initial.py
new file mode 100644
index 0000000..643dddf
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/migrations/0001_initial.py
@@ -0,0 +1,40 @@
+# Generated by Django 5.2.7 on 2025-10-05 10:34
+
+import django.db.models.deletion
+import django.utils.timezone
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Post',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True,
+ primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=250)),
+ ('slug', models.SlugField(max_length=250)),
+ ('body', models.TextField()),
+ ('published_at', models.DateTimeField(
+ default=django.utils.timezone.now)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
+ ('status', models.CharField(choices=[
+ ('DF', 'Draft'), ('PB', 'Published')], default='DF', max_length=2)),
+ ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
+ related_name='blog_posts', to=settings.AUTH_USER_MODEL)),
+ ],
+ options={
+ 'ordering': ('-published_at',),
+ 'indexes': [models.Index(fields=['-published_at'], name='blog_post_publish_2c9212_idx')],
+ },
+ ),
+ ]
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
index 71a8362..88dbaa1 100644
--- a/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
@@ -1,3 +1,33 @@
from django.db import models
+from django.utils import timezone
+from django.conf import settings
-# Create your models here.
+
+class Post(models.Model):
+
+ class Status(models.TextChoices):
+ DRAFT = 'DF', 'Draft'
+ PUBLISHED = 'PB', 'Published'
+
+ title = models.CharField(max_length=250)
+ slug = models.SlugField(max_length=250)
+ author = models.ForeignKey(
+ settings.AUTH_USER_MODEL,
+ on_delete=models.CASCADE,
+ related_name='blog_posts'
+ )
+ body = models.TextField()
+ published_at = models.DateTimeField(default=timezone.now)
+ created_at = models.DateTimeField(auto_now_add=True)
+ updated_at = models.DateTimeField(auto_now=True)
+ status = models.CharField(
+ max_length=2, choices=Status.choices, default=Status.DRAFT)
+
+ class Meta:
+ ordering = ('-published_at',)
+ indexes = [
+ models.Index(fields=['-published_at']),
+ ]
+
+ def __str__(self):
+ return self.title
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3 b/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3
index 7b9ab03361cc267d0d0f6bf6d625e68718ec7c0a..2dea8d61a6d75720659ab4d57e2411d1c990a12b 100644
GIT binary patch
delta 1310
zcmZo@;Am*zoFFZz#K6Fy0>m(2H&Mr!QE6kse0~mTUZ9{bxBO&w0aYe$`OSs`AGx^o
zg;^OyRUMOZ^3x|Tl$YW$HnTD|)U!0RG&3^Y93X8a!YDJjTi=6`eexB3ZDC<9pb_l+
zwG904_)qiS;@`_(yIH^>o1c%DMO2g#WJp1NaS8k6Zu?4R8SY1u*&PfycwBgtco?`J
zZB|rR#9c2V!^*%Yug+eUnOYtX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/mysite/db.sqlite3 | Bin 147456 -> 147456 bytes
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py
index 8c38f3f..a6157cd 100644
--- a/Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/admin.py
@@ -1,3 +1,14 @@
from django.contrib import admin
+from .models import Post
-# Register your models here.
+
+@admin.register(Post)
+class PostAdmin(admin.ModelAdmin):
+ list_display = ('title', 'slug', 'author', 'published_at', 'status')
+ list_filter = ('status', 'created_at', 'published_at', 'author')
+ search_fields = ('title', 'body')
+ prepopulated_fields = {'slug': ('title',)}
+ raw_id_fields = ('author',)
+ date_hierarchy = 'published_at'
+ ordering = ('status', 'published_at')
+ show_facets = admin.ShowFacets.ALWAYS
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3 b/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3
index 2dea8d61a6d75720659ab4d57e2411d1c990a12b..ee68604c48f0ed7c23d7515ffd24ff801506568b 100644
GIT binary patch
delta 1459
zcmai!Pi)(C6vzE1YvzpRt-!WJLCxBtQl_M~fBD&QB-rfqPns-E(yV_clqRv;I(1@W
zC-J6gN(U#z1+*JiIPLXp;sLmx{y0q-h6sz)9PwYeBQDpX}fBd%ySn
zy!X7d#cXXcpZAlaU%ZtdN55J5df;_GtPrpVEASn(;4}CV?rvWUrQrOV6dfkjYN@_v
z7E5YPuNMt-jlR2rlZ;L3*qZMLl2N;&selfr$JqyX++-n@wGR4`~*Rq
zW43=AyTta8kRl-EMZN;<+lcHXZeNy}{$7q@`D5
zQ^LFb+kGp0a3(oNM7sdM>_^pG>RK`l4uCSVJ>_dG(zyl)SLEVAjAv(jn3Yted^p$UCCqTnv0{(%g@Yr+y0|rjfB;eKbSTorR)lhPn3x={xHMN)YfpY(l~-ABMI-GX#v1
zeIz6E>i992PWoNn94x7-rVhqKo40QL
zM+{Dkh&;~;_%g|SK)_Hp2$$3h!wfB$wxPZv0*XgbgcUiA(7oS1P2S8sBH)py`B!-F
zZCYjyvp!jcUXKz5rwRBJPJ8;F2it8bK#Y!zAzAKYUe@n)X@qqrTrrL5#)uOtxte3v
zv{2bLFCLz8KnBGzKDHH&cZIT|$eplsF(S;x+T)W=GC&Lsz0=L$2!!53w@V_MgRZ+
delta 177
zcmZo@;B08%oFL7pG*QNxQE6ks5_usu{xSysm;6`wck`F=ck|EUuh=YDkib8=OkYEZ
zBeAq3BfhjawTOX%K^Vd-NG;0EEH2K>7iVTRW}JMGN0^OWn2A}JWAjaYZG+7$57-45
z**6O|yyu@7z`E#wz@`H%0vrqiKm!;UxKPC(09F5ypEQAGIm-b?0kGEX+z%Lk@-JrD
Jpa7E72LP%rIbQ$(
From 1ee555d269053b30c8269a6755add98ddf08420a Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 13:45:17 +0200
Subject: [PATCH 04/10] feat: added published post manager
---
.../mysite/blog/models.py | 8 ++++++++
.../M1 - Django Learning/mysite/db.sqlite3 | Bin 147456 -> 147456 bytes
2 files changed, 8 insertions(+)
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
index 88dbaa1..9d8e590 100644
--- a/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/models.py
@@ -3,6 +3,11 @@
from django.conf import settings
+class PublishedManager(models.Manager):
+ def get_queryset(self):
+ return super().get_queryset().filter(status=Post.Status.PUBLISHED)
+
+
class Post(models.Model):
class Status(models.TextChoices):
@@ -23,6 +28,9 @@ class Status(models.TextChoices):
status = models.CharField(
max_length=2, choices=Status.choices, default=Status.DRAFT)
+ objects = models.Manager()
+ published = PublishedManager()
+
class Meta:
ordering = ('-published_at',)
indexes = [
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3 b/Projects/Testtrack/M1 - Django Learning/mysite/db.sqlite3
index ee68604c48f0ed7c23d7515ffd24ff801506568b..221ef97b4960e3126712b1a68c20b9ed723f5938 100644
GIT binary patch
delta 494
zcmZo@;B08%oFL7pGf~EwQDFY9l=tj}mzz{A4-
zl7as>|5yI^{4X~P7Tn~Y{(e0pDW#IqA|DFF6|68E!UH-{$?~5;IIlw5u
z!@~E1fqy@LHNP|8i_MA(H~69>SvVQ^H5tPhIUS8$vJ&&s^A$3S6_WGwbC{y5m69`n
zBB?1#RtnWhX_=`xDaAl$v{G
zk*S%z%;;VdM7_qH5W7gIR^f7{2%%61B31Wzn}oKDkHMXn5W;D
vXHwnHvVrjrKOYwZ0|PVvCItc}e!16JE9Tg($!iv&!m
z7Ct~o?_enw(L%N`h0~t@gX5fW&fM;CdADD2`FN3AR;z0}8_BLx6JEV;Y~OUY=`4@u
zsX|Zq!!Pw!
From f4a7a62d7aaa90a1b6b8079c554c905f7c1b1990 Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 13:57:54 +0200
Subject: [PATCH 05/10] feat: added blog views
---
.../M1 - Django Learning/mysite/blog/views.py | 26 +++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py
index 91ea44a..45eb8dc 100644
--- a/Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/views.py
@@ -1,3 +1,25 @@
-from django.shortcuts import render
+from django.shortcuts import get_object_or_404, render
+from .models import Post
-# Create your views here.
+
+def post_list(request):
+ posts = Post.published.all()
+ return render(
+ request,
+ 'blog/post/list.html',
+ {'posts': posts}
+ )
+
+
+def post_detail(request, id):
+ post = get_object_or_404(
+ Post,
+ id=id,
+ status=Post.Status.PUBLISHED
+ )
+
+ return render(
+ request,
+ 'blog/post/detail.html',
+ {'post': post}
+ )
From 08678c05aa1cf1402319670cb4a76a20e82d1ba7 Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 13:58:11 +0200
Subject: [PATCH 06/10] feat: added urls mapping
---
.../Testtrack/M1 - Django Learning/mysite/blog/urls.py | 9 +++++++++
.../Testtrack/M1 - Django Learning/mysite/mysite/urls.py | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/urls.py
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/urls.py b/Projects/Testtrack/M1 - Django Learning/mysite/blog/urls.py
new file mode 100644
index 0000000..d560190
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/urls.py
@@ -0,0 +1,9 @@
+from django.urls import path
+from . import views
+
+app_name = 'blog'
+
+urlpatterns = [
+ path('', views.post_list, name='post_list'),
+ path('/', views.post_detail, name='post_detail')
+]
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py
index 3d1f1da..b7eb578 100644
--- a/Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/mysite/urls.py
@@ -15,8 +15,9 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
-from django.urls import path
+from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
+ path('blog/', include('blog.urls', namespace='blog')),
]
From 59d4a29089f722ef3d55d81951f36f3cf7c34f50 Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 14:22:58 +0200
Subject: [PATCH 07/10] chore: migrated styles
---
.../mysite/blog/static/css/styles.css | 97 +++++++++++++++++++
1 file changed, 97 insertions(+)
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/static/css/styles.css
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/static/css/styles.css b/Projects/Testtrack/M1 - Django Learning/mysite/blog/static/css/styles.css
new file mode 100644
index 0000000..a0a3a89
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/static/css/styles.css
@@ -0,0 +1,97 @@
+body {
+ margin:0;
+ padding:0;
+ font-family:helvetica, sans-serif;
+}
+
+a {
+ color:#00abff;
+ text-decoration:none;
+}
+
+h1 {
+ font-weight:normal;
+ border-bottom:1px solid #bbb;
+ padding:0 0 10px 0;
+}
+
+h2 {
+ font-weight:normal;
+ margin:30px 0 0;
+}
+
+#content {
+ float:left;
+ width:60%;
+ padding:0 0 0 30px;
+}
+
+#sidebar {
+ float:right;
+ width:30%;
+ padding:10px;
+ background:#efefef;
+ height:100%;
+}
+
+p.date {
+ color:#ccc;
+ font-family: georgia, serif;
+ font-size: 12px;
+ font-style: italic;
+}
+
+.left {
+ float:left;
+ margin-right:10px;
+}
+
+/* pagination */
+.pagination {
+ margin:40px 0;
+ font-weight:bold;
+}
+
+/* forms */
+label {
+ float:left;
+ clear:both;
+ color:#333;
+ margin-bottom:4px;
+}
+input, textarea {
+ clear:both;
+ float:left;
+ margin:0 0 10px;
+ background:#ededed;
+ border:0;
+ padding:6px 10px;
+ font-size:12px;
+}
+input[type=submit] {
+ font-weight:bold;
+ background:#00abff;
+ color:#fff;
+ padding:10px 20px;
+ font-size:14px;
+ text-transform:uppercase;
+}
+.errorlist {
+ color:#cc0033;
+ float:left;
+ clear:both;
+ padding-left:10px;
+}
+
+/* comments */
+.comment {
+ padding:10px;
+}
+.comment:nth-child(even) {
+ background:#efefef;
+}
+.comment .info {
+ font-weight:bold;
+ font-size:12px;
+ color:#666;
+}
From e5e6a7ace1d1d8a17b90c95a7667f71e0901f455 Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 14:23:19 +0200
Subject: [PATCH 08/10] feat: added templates
---
.../mysite/blog/templates/blog/base.html | 19 ++++++++++++++++++
.../blog/templates/blog/post/detail.html | 11 ++++++++++
.../mysite/blog/templates/blog/post/list.html | 20 +++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/base.html
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/detail.html
create mode 100644 Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/list.html
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/base.html b/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/base.html
new file mode 100644
index 0000000..2e4bba1
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/base.html
@@ -0,0 +1,19 @@
+{% load static %}
+
+
+
+
+
+ {% block title %}{% endblock %}
+
+
+
+
+ {% block content %}{% endblock %}
+
+
+
+
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/detail.html b/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/detail.html
new file mode 100644
index 0000000..73f1030
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/detail.html
@@ -0,0 +1,11 @@
+{% extends "blog/base.html" %}
+
+{% block title %}{{ post.title }}{% endblock %}
+
+{% block content %}
+ {{ post.title }}
+
+ Published on {{ post.published_at }} by {{post.author}}
+
+ {{ post.body|linebreaks }}
+{% endblock %}
diff --git a/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/list.html b/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/list.html
new file mode 100644
index 0000000..8f182df
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/mysite/blog/templates/blog/post/list.html
@@ -0,0 +1,20 @@
+{% extends "blog/base.html" %}
+
+{% block title %}Blog Posts{% endblock %}
+
+{% block content %}
+ Blog Posts
+ {% for post in posts %}
+
+
+ Published on {{ post.published_at }} by {{post.author}}
+
+ {{ post.body|truncatewords:30|linebreaks }}
+ {% empty %}
+ No posts available.
+ {% endfor %}
+{% endblock %}
From 0c31594398613d408dd8c0440bde1879ccdf471f Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 14:23:49 +0200
Subject: [PATCH 09/10] chore: added note with commands
---
.../Programming/Python/Django/Manage commands.md | 10 ++++++++++
1 file changed, 10 insertions(+)
create mode 100644 Atlas/Engineering/Programming/Python/Django/Manage commands.md
diff --git a/Atlas/Engineering/Programming/Python/Django/Manage commands.md b/Atlas/Engineering/Programming/Python/Django/Manage commands.md
new file mode 100644
index 0000000..73cbee9
--- /dev/null
+++ b/Atlas/Engineering/Programming/Python/Django/Manage commands.md
@@ -0,0 +1,10 @@
+`startap myapp` - create application named `myapp`
+`shell` - open Python REPL in the project context
+`createsuperuser` create an admin super user
+`runserver` - run dev server
+
+### Migrations
+
+`makemigrations name` - create a new SQL migration based on model file
+`sqlmigrate blog 001` - open a SQL migration blog number 001
+`migrate` - apply migrations
From 28dc15ea0ab07ed10a5f6bb7b9c68018853bd299 Mon Sep 17 00:00:00 2001
From: Marcin Kwiatkowski
Date: Sun, 5 Oct 2025 14:37:16 +0200
Subject: [PATCH 10/10] chore: updated Testtrack readmes
---
Projects/Testtrack/M1 - Django Learning/README.md | 10 ++++++++++
Projects/Testtrack/Testtrack.md | 2 ++
2 files changed, 12 insertions(+)
create mode 100644 Projects/Testtrack/M1 - Django Learning/README.md
diff --git a/Projects/Testtrack/M1 - Django Learning/README.md b/Projects/Testtrack/M1 - Django Learning/README.md
new file mode 100644
index 0000000..30a9833
--- /dev/null
+++ b/Projects/Testtrack/M1 - Django Learning/README.md
@@ -0,0 +1,10 @@
+# M1 - Django Learning
+
+Sandbox project for learning Django framework.primarly based on the [Django 5 by example book](https://djangobyexample.com/).
+
+## Sources
+
+- [Django 5 by example book](https://djangobyexample.com/)
+- [Examples source code](https://github.com/PacktPublishing/Django-5-By-Example)
+- [Django documentation](https://docs.djangoproject.com/en/5.2//)
+- [Django Design philosophy](https://docs.djangoproject.com/en/5.2/misc/design-philosophies/)
diff --git a/Projects/Testtrack/Testtrack.md b/Projects/Testtrack/Testtrack.md
index 0f688a7..8457072 100644
--- a/Projects/Testtrack/Testtrack.md
+++ b/Projects/Testtrack/Testtrack.md
@@ -8,3 +8,5 @@ Projects:
2. [p911 - Simple eCommerceBackend](./p911%20-%20Simple%20eCommerce%20backend/README.md)
3. [miniS - Algorithms Sandbox](./miniS%20-%20Algoritms%20sandbox/README.md)
4. [fGT40 - Python basics](Projects/Testtrack/fGT40%20-%20Python%20basics/README.md)
+5. [Skyline GTR - Text Classification](Projects/Testtrack/Skyline%20GTR%20-%20Text%20Classification/README.md)
+5. [M1 - Django Learning](Projects/Testtrack/M1%20-%20Django%20Learning/README.md)