From f039465dd816f5b69fbf057c8e776d1bd1d8ace5 Mon Sep 17 00:00:00 2001 From: Ahmed Zekry Date: Thu, 5 Sep 2024 08:12:12 +0000 Subject: [PATCH 01/15] Finish Introduction and Django Admin --- blango/__pycache__/__init__.cpython-36.pyc | Bin 0 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 0 -> 2498 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 0 -> 904 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 0 -> 531 bytes blango/settings.py | 29 ++++++++----- blog/__init__.py | 0 blog/__pycache__/__init__.cpython-36.pyc | Bin 0 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 0 -> 517 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 0 -> 397 bytes blog/__pycache__/models.cpython-36.pyc | Bin 0 -> 1181 bytes blog/admin.py | 10 +++++ blog/apps.py | 6 +++ blog/migrations/0001_initial.py | 39 ++++++++++++++++++ blog/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-36.pyc | Bin 0 -> 1231 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 139 bytes blog/models.py | 23 +++++++++++ blog/tests.py | 3 ++ blog/views.py | 3 ++ db.sqlite3 | Bin 0 -> 163840 bytes 20 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 blango/__pycache__/__init__.cpython-36.pyc create mode 100644 blango/__pycache__/settings.cpython-36.pyc create mode 100644 blango/__pycache__/urls.cpython-36.pyc create mode 100644 blango/__pycache__/wsgi.cpython-36.pyc create mode 100644 blog/__init__.py create mode 100644 blog/__pycache__/__init__.cpython-36.pyc create mode 100644 blog/__pycache__/admin.cpython-36.pyc create mode 100644 blog/__pycache__/apps.cpython-36.pyc create mode 100644 blog/__pycache__/models.cpython-36.pyc create mode 100644 blog/admin.py create mode 100644 blog/apps.py create mode 100644 blog/migrations/0001_initial.py create mode 100644 blog/migrations/__init__.py create mode 100644 blog/migrations/__pycache__/0001_initial.cpython-36.pyc create mode 100644 blog/migrations/__pycache__/__init__.cpython-36.pyc create mode 100644 blog/models.py create mode 100644 blog/tests.py create mode 100644 blog/views.py create mode 100644 db.sqlite3 diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ec0134aae1590de4192f2120406d97859507048 GIT binary patch literal 130 zcmXr!<>mUFdNYjy2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CU;6qP`MIh3$@wXn z`TFJgMcKs#iOH$@NjZsm>G?1!K0Y%qvm`!Vub}c4hfQvNN@-529mt?!AZ7pnvl<@{ literal 0 HcmV?d00001 diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43a3dc5c34a2df294d8b91bd0b4f09bc1ca8b182 GIT binary patch literal 2498 zcmb7F-B#LI6eb}8qEc&ZZEJtxbet9~L91)p&YIO}gkV`k;v%8W(o(-?$0;IJ9+8r0M}pJ+EwG~){A4nD+t)}3|uPkM>+prElq0Krx zj_*(6dyz6Gr`>@K?JjI;tC+<-T=#K3fT!9+C}}*Tl~hqMHj#{cwP)C-!+XT{scm}v zvE%X`E0zshr$@TJkk9WEo4AHgfbX2~k0Ev`8PKOT@A-!7Czg--p@$%Rg1I9+6P}}Y z4I%rEOL%G{df)J=WApg+PbkKt7I}){N&dw52i`B`GB{mN7{wT8&~^G{VwVxH>^lS6 z^~&RX%OiOIgz(2h%i=BS`Mh&{@jQkN7>H1p|72K0;{BgkE;*hE^iR}KMJD794gaJW z>?Jf%+aukfOG=xby$%CoZR^F)o95>F?r!jM<9+Y_$I@`uUh6%1bZQkpzckkMZD;U0 z2%c?jm(-Bi2x(-lBpiYn*lN54I z$0ot@CR}Q);62w57N_pM4!ipo`d!>jh7yK`z?}KsrM+*tmkFOFrT__`zmk zd)`73E#EA}2XV%ykHTbMWW$Wq+^;t!91$ELH;+>ryqU^7 zuKmF9yi>;o9Zv=dan*&kM_kd5W@+dXh4!gsM1A^hWZ}5MtE(a%P@DFL{RXj3|K!5| zx2yV(`u8x&@dDuWRRNmAK5=RHGQte8OG8gfx7A9JE8_u2&O1SimtyF2Zr0}L9DGGMmImAf3GA$k>7Z6Cr z3=tL^RtfV5^=h>t9f^oF-;!ljZ?_s1xmgQmRq5ccA*zxRE*>fS^~kMfhCG>|CY-qPM?(HS4kP$ z{)0C#x}-dsyYbKXwJHqG!rZUe2SbaznnMh)gEx+yXL9UfmP>PNhFNAf<`%B_%COAE jl}X2YmSr*=$Bp+ReIdhTqg^4NNk>;c$Fa$k;b#5=sK7H| literal 0 HcmV?d00001 diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f5e8f6179024fdcaf7bba2df7023b91dfe64f1eb GIT binary patch literal 904 zcma)4O>fjN5KXe#ZAn}B3vP zoRIhhaABOyN)ZxLEybBQ<2UcUnX{9VZ+unvrF9Jl_01*hSY;5RmhOKm`E!$GK(HnM|&y5iJwu$<2mz_oF% zwsS(5E^W@XzHn{ymX|IswIp1Tv;34eU5nBZpG>g4CCSUrR3et0Czp*XJ-c1m4)jS5 zFBk)=K*(AfHwRc5EkWKEw66QZLH=o<-$_OR1BG}M#crl)I_q_9wB$2TRPyuG$7z;a zRMgr>OBBWisQ+W3-G&=aB=3yc(|Lth9s4`7@%cHmg$J2t|1i2zWz{gD)@VXk&r2(@ znR|b(I%5E-V0(NnpJuS?t(@=d+O;G1hVM!CxwFocJF{I@dQH&4eWlbNbhv4jB|mXe zgDh;vlu4m5h`r-qCfz4_lO47PMS=5C6pQ;kB~;>!SQ;GGpgkJ!G=Bcu*b2wn*b{G$ z2F?5yn0xrY+kQVJzI&w9OlWeW%|~0)l9S!=?_VAwuW#GKr&6<~;?Ex7eLKM|4v)j* F(O)Yj8(;tc literal 0 HcmV?d00001 diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d25d35063a0fa14c1cfa7f84a7af7291abc0220f GIT binary patch literal 531 zcmYjN!EO^V5cPV~CR!+PKt1~!(XJ7_A%s9`8>NEukXDs)*|_W3jf2;-TDwWxYt@h8 zhmh(kCw>7gc(bY$OMYW}X5M?AqrJW4A3PP05h1_H){4XVOW5{(07+&IRpPyEIA0 zj=^n>7A$iMU|qe?T3l;j!ZN`sls6gMhS(u(ayiv68uS;BouDo@4H~S p0-mE($k*8Xu(im6chb+HB~R-+Kls!Q_wyk1+ZK9sKwr{V^gqv>r%wO? literal 0 HcmV?d00001 diff --git a/blango/settings.py b/blango/settings.py index f9209bef27..102144a867 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -11,7 +11,7 @@ """ from pathlib import Path - +import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -25,28 +25,35 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] +X_FRAME_OPTIONS = 'ALLOW-FROM ' + os.environ.get('CODIO_HOSTNAME') + '-8000.codio.io' +CSRF_COOKIE_SAMESITE = None +CSRF_TRUSTED_ORIGINS = ['https://' + os.environ.get('CODIO_HOSTNAME') + '-8000.codio.io'] +CSRF_COOKIE_SECURE = True +SESSION_COOKIE_SECURE = True +CSRF_COOKIE_SAMESITE = 'None' +SESSION_COOKIE_SAMESITE = 'None' # Application definition INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "blog", ] - MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', + #'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', + #'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'blango.urls' diff --git a/blog/__init__.py b/blog/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..565849f39d1e5d72103e186ac3c2f099313cb9ec GIT binary patch literal 128 zcmXr!<>lf|yP3uS1dl-k3@`#24nSPY0whuxf*CX!{Z=v*frJsnFJ1kN{M=Oi=#N<@{q@2XO^n4(dpROMtpP83g5+AQuPAt8Z~VDe(QJvVi6>R=~A%&_tyd=g%n_ys1; z0R)zOe!9E&^j>l_9**lqQ_ntYLyRTyRP>UFYj9 z&7N@fgL%T|1Q_sV0vx;BPfQe$-;n9n2kMb2jk$uxY^GUcx2lf(+J$bBM!zRRaEdn^ zV9`WSAR+?_SxpTU3=yj{!GWV_9(NM|EGb4FY+uK`Go96*)&y+kUGzvG_ZuO=axDCs0CY016- Dj#+~1 literal 0 HcmV?d00001 diff --git a/blog/__pycache__/apps.cpython-36.pyc b/blog/__pycache__/apps.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed9a90754dca9ed357cfb9b0a88d5fd2e64a99aa GIT binary patch literal 397 zcmYLFu};G<5Ix7KRFZZ2{szbud*yk6;VmSS zZ(>2h+|jb@u1s6jRpC3o!KheJ+7ki=IYS^N%Q*&lh@3WrE?Q|*joOz}yq9fdQrx7C zL8WcFs;lL&HP^M$=)w(A*U7|9g=l4?gm94%#2mD*XF@yQ&cCt{}MtdLhm@1Q9XVdPv=Opsyu^y%@Wc$uK;VwSd c_RK!;yFK^+m$8be=cX5<-AjKO>$x-j1FU9ZKL7v# literal 0 HcmV?d00001 diff --git a/blog/__pycache__/models.cpython-36.pyc b/blog/__pycache__/models.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..062c73ecbba03f34e375e35d9d56639fc5e42295 GIT binary patch literal 1181 zcma)5OK;Oa5Z?7Gj^iYyl=jLsLTV0N5i05fBbA7O3N7IC7z_7Ct6 z_(}N6sdpqKPJH8}A|N4QYi4I=cV>6L`SxkI>wTVlo%}Eu`^J_&3-%VIASIdP2}^mv zIoU>Hq-J1p_L50cS~pBuichU;Gq4e{rGtpGh&Zx!!Upags;~jCoivv!DPXyUD$6*F ziZM;yezk}I<+|pqdSSUsOY8PrASm3mFHuQ z5PdX~Y(okM>LZ&nWby+f*zd!nQZTGSC6g~qx3S>oli_)us^K`7aX!4r_1j_=j@9ri z39~52kVnJ$B{pYQbxVk%)IzkVJ}|^?A38YG<|2MDXw|L|S(qvzYEKBHRted@5bvrm zna^lSt=l7YS?X<*M#kC^0Zm4u~|4a)!7`7$mObY8nC_cyu(`#R*lpFSP@cSAR{Pf1-;JyK2Y zyuDnjILcnDD@`P>`!7yMuf*xe?y=ZE+}V9ow~mevN4wjjz`+&Ib6t0LaOzQpAOoQ|cO)H4mZ8@b!u_@2yAaoW! mwx7&Vu=nY`H}q_>mauM!O?0l^XY*I_oL*}4O0lD{+WG|`Vi92g literal 0 HcmV?d00001 diff --git a/blog/admin.py b/blog/admin.py new file mode 100644 index 0000000000..a23b074f93 --- /dev/null +++ b/blog/admin.py @@ -0,0 +1,10 @@ +from django.contrib import admin +from blog.models import Tag, Post +# Register your models here. +admin.site.register(Tag) +admin.site.register(Post) + + +class PostAdmin(admin.ModelAdmin): + prepopulated_fields = {"slug": ["title"]} + list_display = ['slug','publishes_at'] \ No newline at end of file diff --git a/blog/apps.py b/blog/apps.py new file mode 100644 index 0000000000..94788a5eac --- /dev/null +++ b/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/blog/migrations/0001_initial.py b/blog/migrations/0001_initial.py new file mode 100644 index 0000000000..c63b9dbccc --- /dev/null +++ b/blog/migrations/0001_initial.py @@ -0,0 +1,39 @@ +# Generated by Django 3.2.5 on 2024-09-05 08:06 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Tag', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('value', models.TextField(max_length=100)), + ], + ), + migrations.CreateModel( + name='Post', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('modified_at', models.DateTimeField(auto_now=True)), + ('published_at', models.DateTimeField(blank=True, null=True)), + ('title', models.TextField(max_length=100)), + ('slug', models.SlugField()), + ('summary', models.TextField(max_length=500)), + ('content', models.TextField()), + ('author', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), + ('tags', models.ManyToManyField(related_name='posts', to='blog.Tag')), + ], + ), + ] diff --git a/blog/migrations/__init__.py b/blog/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/blog/migrations/__pycache__/0001_initial.cpython-36.pyc b/blog/migrations/__pycache__/0001_initial.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..120cf87f48e50d1adaad12a75c3d7687fdf4c99d GIT binary patch literal 1231 zcmZuxJCoZs5GKHfD2meE*|HNmk8zPkjdY$A$z(hkJHERllbr4G$qgG0q=k6YfdoTP zKFh7s-cQI6$nQy&ZBx0=q)3$osk2>#9Dw`6;@fWlemNXQzpegU{oy;#U(N@QNAg1& z<{O&80j8XSC5%~_D_*#XTX>1r>aOyW;Clx=@PBo{m+rdv#!Y(Qo;j1?Ev*zG>0J$8DxN#KTx@8l5g{DH;hlsOr2B^)|hbTkIQI=R)PL zCB`phz0gLcr6?r&FNNC3w?LdyL!v^wN|h|L=A2sMwGqK8mkJDe&$MYU+NDoLL-E~? zrM^rB(2mr$oT8y~hAkX&Vq9$&DmUkyhoiqxqP(E|8>P^1@MK&i`hP zgT19L8(B6OP^xoX6Q;f{Q#u>6k;og3UL!JtenrsC>u{lTHYHLhF0Q4rG_+OL_o%!l zliL`kt)8YBr75A^C`odhroU{2velB-%gekWu405fz;no#u9(7~TlPgfm*{hb9CE!Q1McitJN-CtmO hU21*bmSFdPUrZ-`O*RZ4bPfI1_RRz|#e^et{{!pRYpehO literal 0 HcmV?d00001 diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0b0c41d12c1a73a9da5e9ce0aecadc859d090e6 GIT binary patch literal 139 zcmXr!<>lf|yP3uS1dl-k3@`#24nSPY0whuxf*CX!{Z=v*frJsnFAM#Q{M=Oi=#N<@{q@2XO^n4(dpRS*qnO>Awl9``ZtREkrnU`4-AFo$Xd5gm)H$SB` NC)EyQVlfai004mCA;tgz literal 0 HcmV?d00001 diff --git a/blog/models.py b/blog/models.py new file mode 100644 index 0000000000..abdee6485d --- /dev/null +++ b/blog/models.py @@ -0,0 +1,23 @@ +from django.db import models +from django.conf import settings +# Create your models here. +class Tag(models.Model): + value = models.TextField(max_length=100) + + def __str__(self): + return self.value + + +class Post(models.Model): + author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) + created_at = models.DateTimeField(auto_now_add=True) + modified_at = models.DateTimeField(auto_now=True) + published_at = models.DateTimeField(blank=True, null=True) + title = models.TextField(max_length=100) + slug = models.SlugField() + summary = models.TextField(max_length=500) + content = models.TextField() + tags = models.ManyToManyField(Tag, related_name="posts") + + def __str__(self): + return self.title \ No newline at end of file diff --git a/blog/tests.py b/blog/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/blog/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/blog/views.py b/blog/views.py new file mode 100644 index 0000000000..91ea44a218 --- /dev/null +++ b/blog/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/db.sqlite3 b/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..3148ae2473d9b01f8fd16e8a811abc27f0cbea5b GIT binary patch literal 163840 zcmeI5du$uYeaCmjw?%R!%QElImPJd}*{n|XF3IIXm&+Z`*4a8gkyvG67A(eBJ|e)FBr%q}$#?cTU{soXZAYxQPTZ$}f-m?X>63(=?~ zNvFhr`h$O7rlDILvmdhUc)P<>(&?k0_b_AfKC_9KKejVRJP3dQ2!H?xfB*=900@8p z2!H?xfWS|mz~r$IbviLREs?L1Pm>Zk9{z{$uY_L={ded~p?jfZ@O#0}244w|kA8jh zozbh*3?C2x0T2KI5C8!X009u#&jij)c%;d>T%l55R}@9fmuuyAS+B&Ecyd9>E+|@5 z$t)_VMJ;*IGMd(iW4->3AlYh^H=$(^6i|>7DilEhL`T zD{Z5h@3d&JR&KW1`I=re@>TtQzGBqY+Z&GJxhFNHD5=Z~W7O06t|v9$X_WM~k#98X z_aEdNMzdNrbq({NWVB=|eU?xUm%APmp=G^U?=*HJLs3;Vkv$)#PHqV&O4eSXioT2b zB(kToiIk#hFNLV18(l{kyCa6@QCz5>jFw3#$%{ei=k>0iwD7a3SIU%6z1hm^rBdE# zHtWrNl{THeZnOpvQD^B)BC9C5QR-~D>nxRT8h1P8rjak!Yi*;}Za-)ktvqe{_)r%V zvyyo60CjP(>q4{Fivyzltz663Iu&PE(-x_WR5F!~XI}_VAKkWAl6D_GHuXk(XhpPC zQcbI8{nSIZt(An`gHhGXm7TgAm66P+uIJ!kU5=IwRk$7mMOY9C%PR<%A8K8Gqk7>`8_E>o|nkKljq5o z$R_y|`7QE?WP{w=&$o5d4Fo^{1V8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IUIbG7KweZAVK7}2ZrWqCjU#*AJn(bvW-M&Eez&DZ^lGIR3ea3{*?jFw2G6!B6c zM_wNr|3^nF68R4K0{LZ9Ad4gz{^#%?hd&)|hOdNAhYyDSGxW94=R@y=ZiZ%qKMH;` z__^TQ!Cwr%6nr}99sQ5duZ@0g^pn&9J|F-BAOHd&00JNY0w4eaeFTn1J(4_q(!W_Y z?(sJyxp`dGb*t8QWY<5D4h>1>8yV-d! zQ)4q?ip1&sA!@OZ_Hb3=ooMX`4Wp+_#6?-;nF(sFKI;+k9Ogn|UxtHb2BFiDL1?vS zh>g<>^O}bVc33mfcGII{)O7l!n=5B8oa;$uCs9IEXXo8QYBybIzF#iG+MFDlnJ$BPPjc%;H1jM(ihnpwRZDCPb!Uw@|aUDYBjG3p>{hV z)3O}lmO`Z6Qb_Ds&dAhq?hF%XH)Ha8HhBJD-z^#^AOHd&00JNY0w4eaAOHd&00JPe zFA1>mzfAs3qW|y#0T2KI5C8!X009sH0T2KI5C8!Xcx(wwxpKX~El{)kZwoSuaqYCq z{(00JNY0w4eaAOHd&00JNY0w4eadn2%QKt3Sla*6qQ?MQEBzVE4jN}4{f zZ|L&?X-YQbNXaZF Date: Fri, 6 Sep 2024 16:40:34 +0000 Subject: [PATCH 02/15] Finish html frameworks --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 2498 -> 2515 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 904 -> 962 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 531 -> 531 bytes blango/settings.py | 2 +- blango/urls.py | 5 +++++ blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 517 -> 517 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1181 -> 1181 bytes blog/__pycache__/views.cpython-36.pyc | Bin 0 -> 299 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes blog/views.py | 2 ++ templates/base.html | 15 +++++++++++++++ templates/blog/index.html | 8 ++++++++ 16 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 blog/__pycache__/views.cpython-36.pyc create mode 100644 templates/base.html create mode 100644 templates/blog/index.html diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 5ec0134aae1590de4192f2120406d97859507048..ef1ce2fd79afdb2c7948cb70ae44b338f597ecf0 100644 GIT binary patch delta 14 VcmZo-Y+__H=H=zGJ3NuC1^^b_19$)c delta 14 VcmZo-Y+__H=H=!3ojQ@N1^^ir1J?im diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 43a3dc5c34a2df294d8b91bd0b4f09bc1ca8b182..127b476135060c32bdbd934c73fb7d2156722e15 100644 GIT binary patch delta 209 zcmX>kd|6o8n3tC;`}oZ?2|fmf#|%h-1ITs&;$ohO%5&>e*;AyX8PXY3SW~1^WKv{P zNzQskj>$7QH37J{FP;DZ delta 205 zcmcaCd`MW?n3tE!CGBP!6CVS^V+JI^0c1M>aWUIO<+=6g3@NNBQYq3YGAXhta_KCY zj4ASSSkf7z#8MQZ#8VVglv3GKl%*L`ROT>cGDb|PAk%yti@T+$TWEsrzQZ*+bd%*)FafAVIUDl-GaV+JI^0%SV?aj^@KNMVR#NMTH2%3;i9ieh2}v6*w2 zb6KKTz-*Qr)+n}AmK4@hrY!a>j%Fqxn=O?si!+O>nJJwqiaUiRm_d_0F`tQnAt@&@ zFFju&G{{H6IX`b>b~zKTUlm(oN^WMJ{w)Sgp2=^S44k64l5+CX^~y3+%ZqQZfY`TK ziZe@6Z?TjXA3 JgdD6qi~v<#JR|@B delta 163 zcmX@a-oYMW%*)I5JN0JT8zu&Z#|%h-8OU}3;$j0Jk-`wgkiwY4l*5?I6ve~{Vl(G3 z=dwhxFfydFq_CtiWwB diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index d25d35063a0fa14c1cfa7f84a7af7291abc0220f..4bf83394f90d6a6e1ea4e459a5945cad73fe779f 100644 GIT binary patch delta 15 WcmbQtGMRBLh}F&$=H=zGJ3NuC6#y5|1Csy% delta 14 VcmeBX>}F&$=H=z$PMgTq3IG*d0|Nj6 diff --git a/blog/views.py b/blog/views.py index 91ea44a218..7851fbf836 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,3 +1,5 @@ from django.shortcuts import render # Create your views here. +def index(request): + return render(request, "blog/index.html") \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000000..afe1b7a44b --- /dev/null +++ b/templates/base.html @@ -0,0 +1,15 @@ + + + + + + + Hello, world! + + + {% block content %} + + {% endblock %} + + + \ No newline at end of file diff --git a/templates/blog/index.html b/templates/blog/index.html new file mode 100644 index 0000000000..14c05b233e --- /dev/null +++ b/templates/blog/index.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% block content %} +
+
Column 1
+
Column 2
+
Column 3
+
+{% endblock %} From d122250950adc167ad29efcc479ee26cd0af30c7 Mon Sep 17 00:00:00 2001 From: Ahmed Zekry Date: Sat, 7 Sep 2024 10:20:49 +0000 Subject: [PATCH 03/15] Finish generic relationships --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 2515 -> 2515 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 962 -> 962 bytes blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 517 -> 518 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1181 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 299 -> 299 bytes blog/admin.py | 14 ++++----- blog/migrations/0002_comment.py | 27 ++++++++++++++++++ blog/migrations/0003_auto_20240907_1018.py | 25 ++++++++++++++++ .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 0 -> 1035 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes blog/models.py | 17 ++++++++++- db.sqlite3 | Bin 163840 -> 180224 bytes 16 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 blog/migrations/0002_comment.py create mode 100644 blog/migrations/0003_auto_20240907_1018.py create mode 100644 blog/migrations/__pycache__/0002_comment.cpython-36.pyc diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index ef1ce2fd79afdb2c7948cb70ae44b338f597ecf0..75977bbe94e3125b7855175897b977eaa064e094 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=y@ZE|}edo=(Y9Rwl( delta 15 WcmZo-Y+__L=H=zGJA88@do=(YvIJ59 diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 127b476135060c32bdbd934c73fb7d2156722e15..e51d192c7ef66501fc14f1e27876ffaa8d16933d 100644 GIT binary patch delta 16 XcmcaCd|8;?n3tDpw#n^{>}NOuEZ_xV delta 16 XcmcaCd|8;?n3tC;`}oa`>}NOuF8Bq* diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index b3cc457bcf6965ab422d0c03e83d09bb9d4195f0..e665c915fa6ce8f8a7ef0f6ede5fab2d79f578a6 100644 GIT binary patch delta 16 XcmX@aeu$mjn3tDpw#n^{?7Nu(DQX1~ delta 16 XcmX@aeu$mjn3tC;{^ZS#?7Nu(D>?;e diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index e34de05e01ac94dbed674f98276a9496e587eb9a..386f6ecc3cbf93b72ccac5d359d0be347bb8187c 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=y@ZE|}ednEuH;{+T4 delta 15 WcmZo*Y+z(J=H=zGJA88@dnEuIcmzxU diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index c7b5eac8954ae225e6b3ae72a3c3473ebae97744..45be0cb7502e9e2d3ee335abeb612a8d709adf0c 100644 GIT binary patch delta 353 zcmYjM!Ab)$5X~f$-R;u$Acfu)gn%~@@mBHR$s*_}2&I^~Y}s^SH=cV~6+FuRn}^`d zlX&$5oD>xYX6C)jyf@?#pKxSh%pkfX*K*YS_PH5p! zqmxNmTn2o$*D*2!jOhJ%K|8;U zkxF667K@j!qy899rU|{oAGgstgC_F1%KK+H*l#3}kYCisR$IUAluS!+L)O@$Y`tyz RSJ)fpv^j(c-@ze_;Tx2#O1=O9 literal 517 zcmYjOu};G<5Vd0mLP=32cJ?wf11mx>At8Z~VDe(QJvVi6>R=~A%A_JeuC=L8t=X966%+fPgskl&E$)(7g5DUG>;#%!ipWVfo0{MvKi`*zt*n5lyFK;dPCkw2!09v@ygV^#06!qrF5bj=$rc;IAejnJDQbD{0BT E0H_Lr_y7O^ diff --git a/blog/__pycache__/apps.cpython-36.pyc b/blog/__pycache__/apps.cpython-36.pyc index 6192650455e513872934fb284ee4251a00d9aa28..1792577931c4b0643dc9d4d67ec76d28f80a5696 100644 GIT binary patch delta 16 XcmeBW?qy~-=H=y@ZE|}fdmAGFB3J}y delta 16 XcmeBW?qy~-=H=zGJA88^dmAGFBOL^o diff --git a/blog/__pycache__/models.cpython-36.pyc b/blog/__pycache__/models.cpython-36.pyc index c5fc2d104eee7cd8363a0a38acf98ec270e40cdb..5d747ecdcf6547a67bb103e9d258c941577fe205 100644 GIT binary patch literal 1792 zcma)7OK%%D5MHkKt(D|go+#S1MS&Ut>_e|b5kq#;qO}v)%7qtpCDQUL`%t(mCoT%~ z;G7ENC-evOFA=@2_x49o}j5PUhq;cN^Wwyxix0qr0#NJYd!nOM23OV@Y4JS$Nsu z5iEfWVF{O(E-aDk!qQz@Vi})U+r4-A+txNSUS3L-RnUS;)pc4-Nnd}W3Z>J@<5H`1 zT70iAVC)XdqEgzyxgi$?!P!?y>;B-TkZ<%w>(N>iVh!QS)Hx8nK9!Lc}ex_|HklGr;L z?(H9Nf1*`Vms)R7oWIOMgHe{gMW(H1WtG%8Eq5Hdw&cFd`N+O}_Wz_A5Le#*L5x z0)$-%-GNRBl5PVhn>Q#D)#2&GGXSE5V-I8}+dAp65uTfBONKJSu3PH1x^v0+UD=f} zsCG~GfNh|@TSyG}={uM)-KEJkF7e}qaf(HjY3fb5LQLsjpdWYV*h>#Ytcmrg z74`l9WNDq&8Ca@`V=D!2YD*>k9OH_6F(r9JzWeWMBz=z#q7KscA&md*`040iIN}~U z@C;4!F}Xe=@c@Fy^TjwztFsni>L~pMgb7cw#kB1Qr-I7;YLVxOzR(|$dvKT(7o(D7 z+g-$3~f^i1u@ zam$(Ra*cLAZLZ8eyRpEI_PxI?+cpKqAZ+@VC delta 629 zcmZ`$O>5Oa6rGz)zTQjHQc8=s(p^9VaV3;T!G5gz`e+{_*@Uz+?Tbz_WhOyd1dDd( zs${J{!$08CU*K%ri#xa8i3-n!3HNZ%O>)kilk49 zClK_X;P6p^!fI?G`WHr)T7O&GLI|;=X#d^418@78bFa_n^Ji?#;v150umlZKLuXRA z8JI{m1>=IZe2y$GyH*yBd{vZ;ArJrZ%rV}HD4UmtHk}a4Lz@hg-+!Ug?GVY*R>MMe z(+w<*Nf829vGsdc6uMPKG0iqrjANBpNc&ay!JFC9;e7Y$JonLZA(csXO5CZc`Ci2Z z%SWe*?(`^B>V(G delta 16 XcmZ3@w3>g3Ih>?(`^B?c?ND??c?NEC>Z{ diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e6af14731a73cb8d17eca00e4d25c642d40416d3 GIT binary patch literal 1035 zcmY*YOK;Oa5VqHjV>?ctK`IAsT*9F#a6=Vp=mRQfLA1U2vU0o=v##wmYqur6mIIgm z5dPAN8xj(KfeXyq=>uEde4ZK4d^6wVdB5-fUH&osWf{g#-omGPfd?~~nHjkm znx@7iBe@k?xgFZgyOni9=e5CX*7<6%4p?dT$_l&8Ix>dNZ~WdEn#!%9u6dDEL!$hg zCo-zJC@SUTfLJ*|r}~Bm7@^6GkYHXLI;nGIvQ;)numW0K)?p5Ksn5E2 zyUb($wLK-Qhqm68fha%}G^mfL4-4sH>ZMERGFxDa*90S${pZP!)TJ}WcVYJ(cNB;nuUm4iPy`S>|h=}v}&M%<(tHGY}+JcVETBknN7sd zRlSy-mTB6~#+zH%q#0w||HE73dixJrzv)Ci)|7RmSW!G8F&- literal 0 HcmV?d00001 diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index 6a6cea193087d75c9c3067383e158363b0ca6101..e5e5274f2d27966f4639ca91f295430df9727be4 100644 GIT binary patch delta 15 WcmeBX>}F&)=H=y@ZE|}edkX*^A_P4E delta 15 WcmeBX>}F&)=H=zGJA88@dkX*^w*+kf diff --git a/blog/models.py b/blog/models.py index abdee6485d..b89e16e8d9 100644 --- a/blog/models.py +++ b/blog/models.py @@ -1,5 +1,9 @@ from django.db import models from django.conf import settings +from django.contrib.contenttypes.fields import GenericForeignKey +from django.contrib.contenttypes.models import ContentType +from django.contrib.contenttypes.fields import GenericRelation + # Create your models here. class Tag(models.Model): value = models.TextField(max_length=100) @@ -7,6 +11,14 @@ class Tag(models.Model): def __str__(self): return self.value +class Comment(models.Model): + creator = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + content = models.TextField() + content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) + object_id = models.PositiveIntegerField() + content_object = GenericForeignKey("content_type", "object_id") + created_at = models.DateTimeField(auto_now_add=True) + modified_at = models.DateTimeField(auto_now=True) class Post(models.Model): author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) @@ -18,6 +30,9 @@ class Post(models.Model): summary = models.TextField(max_length=500) content = models.TextField() tags = models.ManyToManyField(Tag, related_name="posts") + comments = GenericRelation(Comment) def __str__(self): - return self.title \ No newline at end of file + return self.title + + diff --git a/db.sqlite3 b/db.sqlite3 index 3148ae2473d9b01f8fd16e8a811abc27f0cbea5b..fe3806aabf0bc33661c5cb4bc8943dce10f6007a 100644 GIT binary patch delta 1290 zcmZ`(U2NM_6u!rH=GbX^lF^Vtit0KE5Y{YS(w}u2WL{P#e%in^#M74M$IY^(ag{}d zJ)p&)@jwx3$&jT@v(Ry*5@F;u$n9DMMY8KnY=zXr&VfkB|Z{WCZfu?q#Qgn5>rIMMiPnUVBi<7U&JJfzhM$Tzy(~yD|i*p;4}EOWdyO2j6DIN#$xO~hLFa)u}D&& zydDo52Aifs!T5lULE&t+Qq(hZrD8Q(E9sT&KGDO zuwA0im``55Tfox<|G;nX3;Yn@!dLJG)bX@s978V(9PtHg%I%DXo_>Q3xu+ZaQ>xRw z=w5JV-P4xwZ%=wJ2VoEvO4@Us>Oy@SL_jELWv!-loWU(;{tT`8mQ(g}5CkDxD0E;$ z%{NaKt856P4gR|7q$*8d0;87kLvO!>1rS1Q8*E#-ZHJnZKYlX9_OjPn{1NyRIDVZ0 z%lHRc*HUnJU=MO>!lg~;3=DXY)HIe^4CFix*m7Q;$Pwo%XnG5D2E&b!qHtVr?M5vmO$E;>;53cL=OB<0~@ua z$}OC{h1)HQjob2caMBRP1^3xX`8!hCD7x=JTIKKH^4mRb{Fwl*5M03(dVxQ~fREWj zA_54HN#)WxO`5xKUMtTIakS-uWwrnHCGK7quMsrd8$Dn3sDCQqZ37zKEH8Rm;}&YNk}k9GsmPAD_s_yW_*=Y7XwYxUI_V(6W@C zmgMdnS$a_3IaZDs{YQBJvy@)F4ZU8e(UHs4F3f9o4O)C`R#CJUY|Nx$?u p!F6l?HC$dg<+sOyqdyMfAR_)vgPR05akJ^I|4s**6~K;h{{fRnd@uk2 delta 345 zcmZo@;BIK(njkHx!N9-(!Z6@9QO8(VgF#Pb11nI7k^eVHLY)8iX2F6Ueoj$2ULaSP zTYfUTfcnP9k6fGOrJu5haq`$|27lB<2#Kon#s3J_&v)@Mw~O3X{okI&6aFG?)Q%+D(p<^n3>;4fg{f5(5C z{}%sV{sR6w{ssKq8yh3|Cl}aH5#iv^XW)O!f0O?d{~rGN{9XLD{P`Oj!}%xY`%h(7 z;GH{}J-~5eV<_+Dxv}X*%nJOjli4o-1^)7FcD=tpftjE2_;z*&#siGo{Zkm3n6{sE zX0(=J5o5?_n9h~JC?mjnk;RQ!o@o=48DkT}cZU3ljn>=cXE8lw-5!v}xFwTWfjeh9 S`vpdzi7MRNb8a(ESpooQ(_M)G From 348db34a93063900a354ba86629b13e63c451da3 Mon Sep 17 00:00:00 2001 From: Ahmed Zekry Date: Sun, 8 Sep 2024 05:15:37 +0000 Subject: [PATCH 04/15] Finish custom filters --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 2515 -> 2515 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 962 -> 962 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 531 -> 531 bytes blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 518 -> 518 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 299 -> 475 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 0 -> 749 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes blog/templatetags/__init__.py | 0 .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 0 -> 845 bytes blog/templatetags/blog_extras.py | 35 ++++++++++++++++++ blog/views.py | 8 +++- db.sqlite3 | Bin 180224 -> 184320 bytes templates/blog/index.html | 22 ++++++++--- 20 files changed, 57 insertions(+), 8 deletions(-) create mode 100644 blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc create mode 100644 blog/templatetags/__init__.py create mode 100644 blog/templatetags/__pycache__/__init__.cpython-36.pyc create mode 100644 blog/templatetags/__pycache__/blog_extras.cpython-36.pyc create mode 100644 blog/templatetags/blog_extras.py diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 75977bbe94e3125b7855175897b977eaa064e094..41ce62f2ffab6febd4b98a86484cfa1b8a5cb137 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=z`GPpC5y&3=-Cj-s^ delta 15 WcmZo-Y+__L=H=y@ZE|}edo=(Y9Rwl( diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index e51d192c7ef66501fc14f1e27876ffaa8d16933d..22d839d48f32b0837b0a9add14862e1d4668b36c 100644 GIT binary patch delta 16 XcmcaCd|8;?n3tE!%izvN_A{ISDwYKf delta 16 XcmcaCd|8;?n3tDpw#n^{>}NOuEZ_xV diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index e665c915fa6ce8f8a7ef0f6ede5fab2d79f578a6..3546ebe5f9964ead1fffbf33ae7c3e8adcc3246b 100644 GIT binary patch delta 16 XcmX@aeu$mjn3tE!%izvN_T9_?Cm;m9 delta 16 XcmX@aeu$mjn3tDpw#n^{?7Nu(DQX1~ diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index 4bf83394f90d6a6e1ea4e459a5945cad73fe779f..8f7e623b82b87ab56424a30bad78413025cabbb9 100644 GIT binary patch delta 16 XcmbQtGMR^w{WBKia^ diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index 386f6ecc3cbf93b72ccac5d359d0be347bb8187c..ed519cd283bf1cb3b94a9106027b088fd185ff9b 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=z`GPpC5y%GQ!?E}aF delta 15 WcmZo*Y+z(J=H=y@ZE|}ednEuH;{+T4 diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 45be0cb7502e9e2d3ee335abeb612a8d709adf0c..03493502a7c5f134347b637db39e543bcef49998 100644 GIT binary patch delta 14 VcmZo;X=7nC=H=z`GFZsQ1OOE?0+j#& delta 14 VcmZo;X=7nC=H=yjt+bGh2>=)%11JCh diff --git a/blog/__pycache__/apps.cpython-36.pyc b/blog/__pycache__/apps.cpython-36.pyc index 1792577931c4b0643dc9d4d67ec76d28f80a5696..1a56392d9fde4d7b46d0c596292818eba38dbdba 100644 GIT binary patch delta 16 XcmeBW?qy~-=H=z`GPtvmy^Rq7APxi+ delta 16 XcmeBW?qy~-=H=y@ZE|}fdmAGFB3J}y diff --git a/blog/__pycache__/models.cpython-36.pyc b/blog/__pycache__/models.cpython-36.pyc index 5d747ecdcf6547a67bb103e9d258c941577fe205..b31e50cf97157be73295a8ae0f7b6e08e9a51bbd 100644 GIT binary patch delta 15 WcmZqRYv5xu=H=z`GT6xWiwyu8S_7*9 delta 15 WcmZqRYv5xu=H=z8*VxGRiwyu9a0A!? diff --git a/blog/__pycache__/views.cpython-36.pyc b/blog/__pycache__/views.cpython-36.pyc index 6e1425a6cc4a0b840df626530eba5ae69babd5a9..dd4350dc65a9f3a9e65f58ea97492c0cf3007485 100644 GIT binary patch literal 475 zcmYk2y-ve05XbE}A5}lZhr|o8g&{#=MFO z7J&9?@Q$*OhL0$YexM7**oKO=lqpan!yC4hEd%X8NNq|$4#%Mausbk)4$hz&*PbD@ zzX$LKe#0i%0hW>-=6Fv4;Ll^6opgO6xULw@7beezVcVlZ$W_XL`I1zo5jN-mrQ=Zf zFxW=2s99;W4VN6sl_D-nTDehfi`cV~VoyEOM!AhXks3qzy+|wBu(Xtv%XA~vT6c?* zrG;3uD+vLR&zx;^(!JVXfV*z(kO-e*HHA2jqwJX0t|QTvRHp2W9;kNupY9D8dRQr& kxS>fSDT9ogGt3yaIdBtru%l}z>jk@U|EWW8Qw-Pp12xfd)c^nh literal 299 zcmYjMF-`+95M29m35tlI;kdU%-Y_a8To8Bn|_>s-M$jhH}F>yrz^mpfS6bq>O>_3vE=NXD#@c8D)JvpsSv~1 z=?!aFi+D%Ho&nc@pMnCtz~oIrB_*C%dJ&A>+bw^QERm{i_OZS!RDdWJ6~>}hCCTYnU8KH+!#DBvg(-EaliD9b)oKq aPjP9SV*XJM$#8JdS?-O#jQ>bxhuJUR)ImQ0 diff --git a/blog/migrations/__pycache__/0001_initial.cpython-36.pyc b/blog/migrations/__pycache__/0001_initial.cpython-36.pyc index 46fc2d36cc8267382ef09f61fa7ab31058ab77ce..4e5228fe7517291db492dee994e480e58ffccf2e 100644 GIT binary patch delta 16 XcmX@ld7hKqn3tE!%izvN_7f}sDES2G delta 16 XcmX@ld7hKqn3tDpw#n^{>?c?ND?1LUcY?9s?7!hsd`@q_AOHruVJ**iD>A`t zE*d9uFBv%C-Z5~I*WM2&^FVxJvG<4euvnO|txBB_mFjxqw+gW7uL@f`jtK?l^!6VJ zkYyZLCSYFj%t5#IEIa!31UwAtX&u%x@OJ_x5bWGTeY&qhxZ^O}Ii<)Vh)BZ&GyQlx z+_tt)K6oNP4qsK25-tTr=RT2axG#@qx)&e+j2a;hT>bAqc_XwN1-K|D8s9Qma* zp_D|jZII$f%A0N8*fVVgxWNvvD=O?YHIA9!Ex?7N~6_)zCvsf@QB zs-`!=K$Y*RL*tN56RHg!n)H+Dr&f%Gzn95p)nZbR6P4U5{iWaJ1tzP;a?wYX$$fhh zy4y23+FYi~=jp5Tg*;79UoJM^wEdNAqx(k$f#bU_7xX;jzSu|Oir6>Pz0L)!MpvVk m?D1i8)V?@M*H4IR+;^{dA3dXj3108-?v1^U-U>M3f%6Y8$jgNQ literal 0 HcmV?d00001 diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index e5e5274f2d27966f4639ca91f295430df9727be4..a8f61d79efa1f2717be939121278880d5b098431 100644 GIT binary patch delta 15 WcmeBX>}F&)=H=z`GPpC5y#)XpECcBP delta 15 WcmeBX>}F&)=H=y@ZE|}edkX*^A_P4E diff --git a/blog/templatetags/__init__.py b/blog/templatetags/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..084e4a47b7c4dd73baad9091eddec9bb0e88bb64 GIT binary patch literal 141 zcmXr!<>lIMb0>`f2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUsn1V`MIh3$@wXn z`TFJgMcKs#iOH$@NjZsm>G?n^KV82hHMbxqu_U!5F}+wnK0Y%qvm`!Vub}c4hfQvN PN@-529mvdLAZ7pn8Db+N literal 0 HcmV?d00001 diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fb563c866153fda75d7fcc559de2b06011012963 GIT binary patch literal 845 zcmY*Xy>8nu5ayp~S#gXMNl~Cf5oD?s8%4LmF$#2Tvjpg%MW7{0mZKkoq*2GQCiN|X zK0sfIK&MW9g-kul37V4Nci)l6qtw1dmV0B?Wee8Q%>lplPaAnc%bf%4J>U{o1&Zdv_0iW;AX5xIQ zWOjK`iJ~;khr9M-zGJhgnD6*q>t;BxL7|IU8&N0H2LCdm+$U|26-t}97L~NaQan-L z+4Y;AbiPB+aMe') + + + if author.first_name and author.last_name: + name = f"{author.first_name} {author.last_name}" + else: + name = f"{author.username}" + + + if author.email: + prefix = format_html('
',author.email) + suffix = format_html('') + else: + prefix ="" + suffix ="" + + return format_html('{}{}{}',prefix,name,suffix) + diff --git a/blog/views.py b/blog/views.py index 7851fbf836..f1eff057df 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,5 +1,9 @@ from django.shortcuts import render - +from django.utils import timezone +from blog.models import Post # Create your views here. def index(request): - return render(request, "blog/index.html") \ No newline at end of file + posts = Post.objects.filter(published_at__lte=timezone.now()) + return render(request, "blog/index.html", {"posts": posts}) + + diff --git a/db.sqlite3 b/db.sqlite3 index fe3806aabf0bc33661c5cb4bc8943dce10f6007a..30ede21581498a63842d68eb44d682b5e8e7be45 100644 GIT binary patch delta 4383 zcmcIodu$v>8QO9>fu1TuM-Sds_*0;Cg z?C#mURMGlCMM4N@Fw#X8YN>>P04i}@)qkM2NChDkp$G}7idsNwC0Zh&s14zfO7P8| zUx{M{LOE%_eay`F{pR=m=G&c{oD5HXEBwsHH9I(ti_RT9oCnYKsQixUC%%n*t)WX( zfz@3?=+bm;GPEPp+QhYfCYv*8L6RhONUJz>NRgD7l$Mf1vLvV2O;k!pr6iWsj2h1< zN^eq5s!Dq1&l~P-x_^KRA<2jSfOerDqjB_Q^gMbINhpWjMC+$(H(LB?fNMLKy$3~F zeC<37G&DwSN0{2Ry|p8Zp5-C{u<=`qd|it@h8(S63sd9UJMV?&CN9zp;{jiBsA3aK zn0j&hr}?#0SGI5ATQ5m|DJZmD;94%AC#GwBi@*<@t9@hLPdvZ17$4zkJ5_O0TUr#= z^;48;kHKu@j4Eg3_(^KytHUMxm~M<~TCq&>x_*X~tm;FBvZfoo!?e7>K^#k|jFiYo z@*@?~Ay#dZz+7{|wvF+isJ4OYR`=NFCQctXYK)&z`*Ji}+Fvc4s2cfBt?y_>+B-0s zIDL43JgsL34(t61vpi@Gqz|S{>&X6nC->3QS#`8}Xy-7^>r~HKT2U{1kX8cZB}I;9 z6gkU~hhV}%0bS+LRdju3&DhTozvWzZ-MX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UM%Q_cqf diff --git a/templates/blog/index.html b/templates/blog/index.html index 14c05b233e..496b061d55 100644 --- a/templates/blog/index.html +++ b/templates/blog/index.html @@ -1,8 +1,18 @@ {% extends "base.html" %} +{% load blog_extras %} {% block content %} -
-
Column 1
-
Column 2
-
Column 3
-
-{% endblock %} +

Blog Posts

+ {% for post in posts %} +
+
+

{{ post.title }}

+ By {{ post.author| author_details:request.user }} on {{ post.published_at|date:"M, d Y" }} +

{{ post.summary }}

+

+ ({{ post.content|wordcount }} words) + Read More +

+
+
+ {% endfor %} +{% endblock %} \ No newline at end of file From 9c16c346c3911bf4159e1f769d41c8610acdea4c Mon Sep 17 00:00:00 2001 From: Ahmed Zekry Date: Sun, 8 Sep 2024 18:03:39 +0000 Subject: [PATCH 05/15] Finish custom template tags --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 2515 -> 2515 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 962 -> 1033 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 531 -> 531 bytes blango/urls.py | 2 +- blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 518 -> 513 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 475 -> 692 bytes blog/admin.py | 2 +- .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 845 -> 1745 bytes blog/templatetags/blog_extras.py | 75 ++++++++++++------ blog/views.py | 5 +- templates/blog/index.html | 8 +- templates/blog/post-byline.html | 2 + templates/blog/post-detail.html | 21 +++++ templates/blog/post-list.html | 6 ++ 23 files changed, 89 insertions(+), 32 deletions(-) create mode 100644 templates/blog/post-byline.html create mode 100644 templates/blog/post-detail.html create mode 100644 templates/blog/post-list.html diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 41ce62f2ffab6febd4b98a86484cfa1b8a5cb137..bf3b72962a772019ab7dd94333150d9cd650e455 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=zuW_EWXdo=(Y(F8#N delta 15 WcmZo-Y+__L=H=z`GPpC5y&3=-Cj-s^ diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 22d839d48f32b0837b0a9add14862e1d4668b36c..816f47f190cfde9592692c076aa04095ae296a96 100644 GIT binary patch delta 16 XcmcaCd|8;?n3tDpo7vrs>}NOuEwcrI delta 16 XcmcaCd|8;?n3tE!%izvN_A{ISDwYKf diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index 3546ebe5f9964ead1fffbf33ae7c3e8adcc3246b..dcdf6411ddc3bbdebd3b5a0430e942424570703f 100644 GIT binary patch delta 178 zcmX@a-pQeC%*)I5z~*jR7Bd6GV+JI^4rDt3adF5*WqYYqmK63>wk*yp?i7v`&R*tp z<|v*NmS6@=u8lcUnY5~S3i69f^lgfBO4IH1s|1pA^3!!eLb@rbC5f3invAzt@)C1X zHF+m9Gsh@Laf9UIA#%64ON(*}5=%-_i}H$BG8FLvEiK}kT*_=OzyoBmF!BH)2P=pK E041X=T>t<8 delta 107 zcmeC=IK-}O%*)H=WpF1=m6?IzF#{4{0kR!{xY%W)vOQNiQxta!OE7~b`^K87OiY?Q vldYL!#BOny7UdKqmXxFx<)^w{WBM1Z> delta 16 XcmbQtGMR/", blog.views.post_detail, name="blog-post-detail") ] diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index ed519cd283bf1cb3b94a9106027b088fd185ff9b..9a6761a376cdbbcc9c293cda22ecef8466d31225 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=zuW_EWXdnEuImjpWi delta 15 WcmZo*Y+z(J=H=z`GPpC5y%GQ!?E}aF diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 03493502a7c5f134347b637db39e543bcef49998..c2a446a5be0118dd0603a2da84e756263c498f5c 100644 GIT binary patch delta 75 zcmZo;X=LFv=H=y*e|R@dY$E4YQ!xexhE#?q#uSDqrWD2$rgX+k#wg|#=3oX*mRpw^)jEO4Dz#mSmRXr21|A!N&*y&=nQd delta 58 zcmZof(cNphYEULaiE^7 zsE?~S)R9X1v`Vp#Me>zZBaw;`=1gQCSaJ3TFR+69)X24v#$PU_tM#Ij4JK1xy}T;G zXRht#POl}_@q2AugN%X^lLY-8x_yShu?{-!qAq?wUf4-sO6Wqo?v;<_<0O{2Bm8e)MO zMn--bq;)36{s%K-On;x3E8WYo(W2GmR-2D@GjC+MQ1kUtV?xN!t=!t#=8I1PIH6fO z&fqba3Fd|X$RhOra-U-3n1el_P=3!HKMLh1LVax2u-rWfK&0n|kZ#_pgTk05MP%r1 zP_llQv7m~LHA{uWT2&x*Mo4VlXzZ4>b}XHpg@uI|K;7Bdc^bpU z#9MGd48 fd2PrU=it}_tN${gG?fb~8?0H?c?NEEWY^ delta 16 XcmX@ld7hKqn3tE!%izvN_7f}sDES2G diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc index 436abc384f8aaf4b1892fba0cf97066f5fd9912c..e6fbb6c28c237ef0fb137392496fead234561f7e 100644 GIT binary patch delta 16 XcmeC?=;mNI=H=zuW_EWYI|~Z{B6}F&)=H=zuW_EWXdkX*^)&yJt delta 15 WcmeBX>}F&)=H=z`GPpC5y#)XpECcBP diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 084e4a47b7c4dd73baad9091eddec9bb0e88bb64..5c93966e2fee3bffe2e1be81019447254815d534 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=zuW_EWXdm8{A5CmcX delta 15 WcmeBW>}6y(=H=zuZ*ylNdm8{AU<7ag diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index fb563c866153fda75d7fcc559de2b06011012963..8924f6541e5e87bd533525e86b1a8556eb46c4be 100644 GIT binary patch literal 1745 zcmbsp%Wfk@u)F7Jdz_c^*dPQ^q&-*y`>?l_6CrV31q7VtGMY@cow4U(y4!5lYoEMu z;|l^GfVlECEpb8|_80ajoZ4r%k z_z4eq_>QhZ}G@-_buJ#JC=I@REO`bDBt7z_Td+?lesR^|xr$wp-;5#FslbI4SDQhl@E;GJRSvnP_HLPWs>f}b31qe3E zR8A6=4)K=zb*;1^8AXlo;qJit5|(NL(2$@7SurrnuI7gWp8s%`6{%7e=dyl%_I7!G z*`*S4jQ+I6t(IwG`9l3hBx?9@(Z8un(a&n0*ZtSEoTzDq0^DF zCyCXhdeb+?0Xr>phXEi=MgTKJw;!Hce?vgf-xXbZ>ksp~b04XUmu0}wJneLWVLRwfX)Sux|nxX727dnlm}Y)^9)Nvk)pdOigKh0ROY zGb&GD{|-w|rxT%)tgbYa%>BDzDWGe%E`9<8Jf{!?UC=REGN3RbXW@+L(p|UzCMR zb9c~BFC_*y_unq@?*_)jt~Y)<(>JxWt!SFVTq>PZX(>ztx^;twC}|Hpfoi*<2{xIN zr=T>BvYC|dl6H_-2j$0bZd`lGpMpdAt?|`t2>a95I#_#24VlAKo~>4Qkz!oKL)fvGlC`YOMcseEHXDMrvLLdMO1r>beH944;7 z*z6#ZI4vahu*60)?Yx58R(V}n5v)=h+=E=qNEHK16d`r!0$D0CWQi`ZQ!b_fIggv_eEf3zS>}(f)w?$Cycg2am6h{FwXh+royFP3 z#@O}tmwa-Z1Xa}j^#-TeqDHippT&$ItKz~2^%m{2ybQ|KOX5!qhua%C84do_%#8I# zxpry%f(Halq#%U`EiyRZS}4dM',extra_classes) + + +@register.simple_tag +def endrow(): + return format_html("") + + +@register.simple_tag +def col(extra_classes=""): + return format_html('
', extra_classes) + + +@register.simple_tag +def endcol(): + return format_html("
") + + +@register.inclusion_tag("blog/post-list.html") +def recent_posts(post): + posts = Post.objects.exclude(pk=post.pk)[:5] + return {"title": "Recent Posts", "posts": posts} + + +@register.simple_tag(takes_context=True) +def author_details_tag(context): + request = context["request"] + current_user = request.user + post = context["post"] + author = post.author + + if author == current_user: + return format_html("me") + + if author.first_name and author.last_name: + name = f"{author.first_name} {author.last_name}" + else: + name = f"{author.username}" + + if author.email: + prefix = format_html('', author.email) + suffix = format_html("") + else: + prefix = "" + suffix = "" -@register.filter -def author_details(author,current_user=None): - - if not isinstance(author,user_model): - return "" - - - if author == current_user: - return format_html('Me') - - - if author.first_name and author.last_name: - name = f"{author.first_name} {author.last_name}" - else: - name = f"{author.username}" - - - if author.email: - prefix = format_html('',author.email) - suffix = format_html('') - else: - prefix ="" - suffix ="" - - return format_html('{}{}{}',prefix,name,suffix) + return format_html("{}{}{}", prefix, name, suffix) diff --git a/blog/views.py b/blog/views.py index f1eff057df..5b3d1cb303 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,4 +1,4 @@ -from django.shortcuts import render +from django.shortcuts import render,get_object_or_404 from django.utils import timezone from blog.models import Post # Create your views here. @@ -7,3 +7,6 @@ def index(request): return render(request, "blog/index.html", {"posts": posts}) +def post_detail(request,slug): + post = get_object_or_404(Post,slug=slug) + return render(request,"blog/post-detail.html",{'post':post}) \ No newline at end of file diff --git a/templates/blog/index.html b/templates/blog/index.html index 496b061d55..ec9337524e 100644 --- a/templates/blog/index.html +++ b/templates/blog/index.html @@ -3,16 +3,16 @@ {% block content %}

Blog Posts

{% for post in posts %} -
+ {% row "border-bottom" %}

{{ post.title }}

- By {{ post.author| author_details:request.user }} on {{ post.published_at|date:"M, d Y" }} + {% include "blog/post-byline.html" %}

{{ post.summary }}

({{ post.content|wordcount }} words) - Read More + Read More

-
+ {% endrow %} {% endfor %} {% endblock %} \ No newline at end of file diff --git a/templates/blog/post-byline.html b/templates/blog/post-byline.html new file mode 100644 index 0000000000..3b00a83c48 --- /dev/null +++ b/templates/blog/post-byline.html @@ -0,0 +1,2 @@ +{% load blog_extras %} +By {{ author_details_tag}} on {{ post.published_at|date:"M, d Y" }} \ No newline at end of file diff --git a/templates/blog/post-detail.html b/templates/blog/post-detail.html new file mode 100644 index 0000000000..024d70f0c2 --- /dev/null +++ b/templates/blog/post-detail.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} +{% load blog_extras %} +{% block content %} +

{{ post.title }}

+{% row %} +
+ {% include "blog/post-byline.html" %} +
+{% endrow %} +{% row %} +
+ {{ post.content|safe }} +
+{% endrow %} + +{% row %} + {% col %} + {% recent_posts post %} + {% endcol %} +{% endrow %} +{% endblock %} \ No newline at end of file diff --git a/templates/blog/post-list.html b/templates/blog/post-list.html new file mode 100644 index 0000000000..35e5572af5 --- /dev/null +++ b/templates/blog/post-list.html @@ -0,0 +1,6 @@ +

{{ title }}

+ \ No newline at end of file From 0e49684f996ad94c30c4f21f391a6c0f3732f3f1 Mon Sep 17 00:00:00 2001 From: Ahmed Zekry Date: Mon, 9 Sep 2024 10:34:06 +0000 Subject: [PATCH 06/15] Finish crispy forms --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 2515 -> 2633 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1033 -> 1033 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 531 -> 531 bytes blango/settings.py | 5 +++ blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 513 -> 513 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 0 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 692 -> 1014 bytes blog/forms.py | 16 +++++++++ .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1745 -> 1745 bytes blog/views.py | 24 +++++++++++-- db.sqlite3 | Bin 184320 -> 184320 bytes templates/blog/post-comments.html | 34 ++++++++++++++++++ templates/blog/post-detail.html | 5 ++- 22 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 blog/__pycache__/forms.cpython-36.pyc create mode 100644 blog/forms.py create mode 100644 templates/blog/post-comments.html diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index bf3b72962a772019ab7dd94333150d9cd650e455..f594112c613aec1c996ec8a6c465b29424b53492 100644 GIT binary patch delta 14 VcmZo-Y+__H=H=z`d^wS=1^^eV1E~N2 delta 14 VcmZo-Y+__H=H=zuW;T(n1^^cU17iRH diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 816f47f190cfde9592692c076aa04095ae296a96..3c6792d5e690a99a3141b1ab2835757961430574 100644 GIT binary patch delta 334 zcmcaCd{RW&n3tF9h>ImAD!10B2&agob4CfLh^C08h^I)T zNT#z!iKIwHiKa-WvZu&MGo&-7u%^hS$fd}qD5NN+vt%-+D9vF>XN(d{QH~N%QAtq+ zs#B9@NKv1|l*t$+k)n~J2~?wzq6H?k!K6+mV>(NeWQuN-REl1dbP8*f3=qqvNU}!B zrRYb=rx-*jq!>mi0eEh>*UE)JreFJ3X3B~{eYqSU=^bsZ!IlOJHSeTzh1PCEMmCbLLayC2ZRY&DxCO#X-y zlQ(&uyu)*M9=1QRtmJk2-ntpaKJ0G^`R9^d`s5$>!XO(q9AuG0Ug+e&r7Q{?14WMs z4jmp!D5HX^&_a&dSreRcs8b#d__Awy46U;ga&pl|M>cJAe-3``gG6OyU diff --git a/blango/settings.py b/blango/settings.py index a76204cbd2..04c10ce99a 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -45,6 +45,8 @@ "django.contrib.messages", "django.contrib.staticfiles", "blog", + "crispy_forms", + "crispy_bootstrap5", ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', @@ -130,3 +132,6 @@ # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" +CRISPY_TEMPLATE_PACK = "bootstrap5" \ No newline at end of file diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index 9a6761a376cdbbcc9c293cda22ecef8466d31225..d3d9217f7c28dfe78400107d4b8ccda67c6eafd7 100644 GIT binary patch delta 14 VcmZo*Y+z(F=H=z`d^wS=3IG>&1ET-{ delta 14 VcmZo*Y+z(F=H=zuW;T(n3IG<%16=?B diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index c2a446a5be0118dd0603a2da84e756263c498f5c..9569d490ef017e3bfcbb409d1b21d29d61e094b6 100644 GIT binary patch delta 15 WcmZou(g@ z`aK-Fbm}j3>K$bxZYk*WsMFo!yQjCK(XjpTbM}oA@{1fS4)_Dy{v3iPnp)CONhxAx zS(C^l;>7YMm1)G>iYAj8C7*~+wRj*}7`n)}i5%$ck`(!G=tT+|(pl>o4O}L0T=GZ4iA;eu z4M#f~Z2V74P~EG1bL#}l_9IzWe4Y;79!+IEz8Cz6^2SR ztzKKi$4Y%!m$uJ1JbFkWX>1U)+F0$s6E}jlG5k53T(^yxRIRSt$!+Uy{HmYf3pPzx^P!VJFjZyt)?3=>*$mmlv+b#weI?& zByex+Eb!9JeGoUd_yl(cN>#S>9_pk16KLX2A>hs<1EHrhr}r-pr@rSbghT0WfMJLM zWybn2+I6mswfpYaw4m-aeiWIIAcK21ypuGFnij(#^a7{t7-Yi{&U_pV^U*!|qH?ug u-KpLOTi&%hrT=C6arCnpT%hCl*F}~m!=I#w{9XUgyhr~$iaVz9O8x?7huBvD literal 0 HcmV?d00001 diff --git a/blog/__pycache__/models.cpython-36.pyc b/blog/__pycache__/models.cpython-36.pyc index 59417ae84cc5fe43876d1199b8e63a2786721857..360fd3f8933965e04b324682f6e97820a099c04c 100644 GIT binary patch delta 15 WcmZqRYv5xu=H=z`e7TYB7aIT_@dRT4 delta 15 WcmZqRYv5xu=H=zuX10;-7aIT_00bQX diff --git a/blog/__pycache__/views.cpython-36.pyc b/blog/__pycache__/views.cpython-36.pyc index 881849cb336d23ea65237d0c1de1954f7892d224..bd680fe1e21f4522314d6fd599ccd0f071055c86 100644 GIT binary patch literal 1014 zcmYjQy^ho{5VjrXXS2Ka14lzaK^G);k+>2eq!U-61L>$z5M^WUZgNSyXM6YHl&zMQ zH=sv6059W$hKg69VkUdV+49U}JobF^jq`Fmj^F=wmf+{M7GluMV0p4SSo{Q8P#fVEZEYO43+_A_6@WgG-Xcf8j=wcrMVg z6;iw7g|wNPRk8r3v(p!+F49tz8XO6Aku4i}t6B**|DX)|hG(j2WNXirZVHO`!9d79 ztTR~VDF{m{S~2TYdLV<#mn^NAG$?A*q`{bC-a1ew(p!yJWfeCP6O5Ez+~|iKEYrFbtZR&7qsgfrh6@_B8Xgf%h>eO_mq7+(;KR(k_+IA%+}- za1m^7^12j|Jco#bLbVnz+jq!?g_gNhS|f>Wu*&T+D_h9a_sQ2Iyy*zVLlh?%72W~r zo3f(cNphYEULaiE^7 zsE?~S)R9X1v`Vp#Me>zZBaw;`=1gQCSaJ3TFR+69)X24v#$PU_tM#Ij4JK1xy}T;G zXRht#POl}_@q2AugN%X^lLY-8x_yShu?{-!qAq?wUf4-sO6Wqo?v;<_<0O{2Bm8e)MO zMn--bq;)36{s%K-On;x3E8WYo(W2GmR-2D@GjC+MQ1kUtV?xN!t=!t#=8I1PIH6fO z&fqba3Fd|X$RhOra-U-3n1el_P=3!HKMLh1LVax2u-rWfK&0n|kZ#_pgTk05MP%r1 zP% diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc index e6fbb6c28c237ef0fb137392496fead234561f7e..b5ff8850513bb0a762df850b74903d2cbd0771a1 100644 GIT binary patch delta 15 WcmeC?=;mNE=H=z`e7TX0l?4DCodb3N delta 15 WcmeC?=;mNE=H=zuX10-yl?4DBtOGCr diff --git a/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc b/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc index 8a88e507b8102693e33354793e46481174e4f1c3..a4bea77856c2c219a34871411457d0c4ab19c47e 100644 GIT binary patch delta 15 WcmaFM`j(Z=n3tE!^W{di=S%=7$psVu delta 15 WcmaFM`j(Z=n3tDpo7qOT=S%=6*aXf1 diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index 0ff38c51db6ffb8b7e287a20433a1e2794c6273b..5b5391c7df1d6e1602786adcb3a54a0942b180cc 100644 GIT binary patch delta 14 VcmeBX>}F&$=H=z`d^wS=6#y8Y1H=FT delta 14 VcmeBX>}F&$=H=zuW;T(n6#y6X1AYJi diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 5c93966e2fee3bffe2e1be81019447254815d534..780f0dca5ca23215b39b6c8bd3223896f318f921 100644 GIT binary patch delta 14 VcmeBW>}6y#=H=z`d^wS=9RL{B1IhpZ delta 14 VcmeBW>}6y#=H=zuW;T(n9RL_A1B3to diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index 8924f6541e5e87bd533525e86b1a8556eb46c4be..c0dbaf03dbc2e962b867002713d5f9b922a3bfac 100644 GIT binary patch delta 119 zcmcb}dy$vZn3tE!^X1*N^&2@QnN1lPAb<%-F$1wP5Em-}i4uk^#w?~9hAie3#$Lu0 zh7_h&CP{``#uVln#>wH##;Pnu>_BC=*z=RJQj<%HZ?UIVBfDuSD1FGe#s;ouqKxMbs^OLetlS_(kv8Prf=aim$>q}gyGxo} zo3vx3aemfy1^dOxVEeFrag^YSUs}f8mpTwZ&}}MHKiCfcA=Anf^qQJkHiq}%{qjD~ zbMNnY-rsNWqG9o(;oM=|v-E-o_pF|JXu-+l3F`?QEx&Jd;jQ&;>tU)Lkvo|2Dx4yB zR%_d2N6m^ztaeP$cam1UULcnX`GeK|@o;d$Ioa<|1){O&gk6Yd!hG}y?GC0WiSJ96 zN)r{^Y-DbrFY09D_V|=y&19vN=v;6I{Qi-wy?l(OXx2>eW{NY}co)UHXxhRs49#+} zlq@BrN=z=~q*tfqSUP7B^YVVYQ6q3JhOsz!mZ2Q=tIA2d9l?DJ9>9J0y?$Wv7IeOh z?fdko6L09E`h)7Bj&?*WVa9vpbz*6?c9y8V(T!SzXU7Ceq8U+D@-}gHK~%H+jBPGM ziMd3vI3p*sCE6nSE0dWZ6)LBNk<_qxpfo?o1$@qmBfx}5+|fuOlAk^s5f2DsiCMJvOkYh?IdgoGZK2f!2V@hPIFrQ*ZM;+9>bD)yU zQDNR}o}Tc$9`|L1lvzrP^W01(SZ1S%AxG3*VnbPfVALtlLTGF_R+^3ZN}h-+3SO@= zkmBZwQfRmsb=gYF@SyBUCdxcLmM#u1n1}j(l4m^Vjmpw|K|OK2Oo>OG3Q8fzVczhDP`g&$!{ zV}A{I;4}CHHsK>!*I4iFu~37Bh?UI^+|@-IE@4`~3NGUx#8 zDc^yfE+pX1NuQ1h?Y5V1ymx5ro4@g%MM4K#7(9Z9@DprlcjF6qZr9be)<)GeDq4H= zc1wGQ2HnQ~jbdAa-hrdLZPb9G1{5J3(&H_pcDZ!MyBO3V1>MHGtF=vIb)dBkdr^<$ zg5b$3YFe3<+E8;$iZ^L)GB%f8GnBD$l;c?)hV|;&uugneXSyiG)RuiJjn|?X3vF}q zk5xF+l=hH3Zqasj2(@87jd99(B_S1)v$@<$Pii%j;aG~=r?vMcH8SH^JGEBdXbE=w E0~0TFcWn zE?VKhgq!PSrk9a2v!ruM=CfBGQFu) z&Fq#Ys>K;DrNwX!OL&*I;T&-!$k;CiMYA&Y;#XiZwD5o%oZ}S7u+hUiI=Ga20|mQ6 zQxeq~zVV4yJmX2?TU_A+XQ)fGgF@Y=s9#Yd3`a;Ks(MWKrqxGvMU9x*L6y%b zgComments +{% for comment in post.comments.all %} +{% row "border-top pt-2" %} + {% col %} +
Posted by {{ comment.creator }} at {{ comment.created_at|date:"M, d Y h:i" }}
+ {% endcol %} +{% endrow %} +{% row "border-bottom" %} + {% col %} +

{{ comment.content }}

+ {% endcol %} +{% endrow %} +{% empty %} + {% row "border-top border-bottom" %} + {% col %} +

No comments.

+ {% endcol %} + {% endrow %} +{% endfor %} +{% if request.user.is_active %} +{% row "mt-4" %} + {% col %} +

Add Comment

+
+ {% csrf_token %} + {{ comment_form|crispy }} +

+ +

+
+ {% endcol %} +{% endrow %} +{% endif %} \ No newline at end of file diff --git a/templates/blog/post-detail.html b/templates/blog/post-detail.html index 024d70f0c2..d23fe4b0a3 100644 --- a/templates/blog/post-detail.html +++ b/templates/blog/post-detail.html @@ -1,5 +1,7 @@ {% extends "base.html" %} + {% load blog_extras %} + {% block content %}

{{ post.title }}

{% row %} @@ -12,10 +14,11 @@

{{ post.title }}

{{ post.content|safe }} {% endrow %} - +{% include "blog/post-comments.html" %} {% row %} {% col %} {% recent_posts post %} {% endcol %} {% endrow %} + {% endblock %} \ No newline at end of file From fab26cf3816d3e883cea64134ba8d477a357f2e4 Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Fri, 13 Sep 2024 16:20:31 +0000 Subject: [PATCH 07/15] Finish django configurations --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 2633 -> 3462 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1033 -> 1077 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 531 -> 521 bytes blango/settings.py | 254 ++++++++++-------- blango/urls.py | 1 + blango/wsgi.py | 7 +- blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 513 -> 513 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1014 -> 1014 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1745 -> 1745 bytes manage.py | 3 +- 20 files changed, 151 insertions(+), 114 deletions(-) diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index f594112c613aec1c996ec8a6c465b29424b53492..88e558c4a689507d8b7be5b904e350fdfc705814 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=yz6Ma09y&3=-Gy~26 delta 15 WcmZo-Y+__L=H=z`e0g^wdo=(Z!UTr^ diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache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uEh)*& zOD~?x&TP!cKiQhuS&%y=D={xUUoSa7FRh3LXyN2qW^*pc KIT(3ZK{No^&?Q9x delta 140 zcmdnW(aE7~%*)H=`SNaB7Bd6GV+JI^4rDt3adF5*Wp$%emK4@hrY!a>j%Fqxn=O?s zi!+N0%w`9(xl=e&ID47XnWK18Sb`Zexi)rmGfkFfHfH3V9L(%Ic?Gi>8z0cPBEHE_ SnC%64fJ_!f9w6jk1(5)+IT}p> diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index ec9d3e1600ba838610f5f550cd2b8e8af63f945f..9f6fa5c9c153d3aaf1cb5ceef75a2f688f1299a0 100644 GIT binary patch delta 197 zcmbQt(#gVU%*)I5TlaBV-9%1JnN-FsrYzTij-cscsH`^P)``?-0#hXy%@c>4QAu>=(5r)VQe%>vv;?$Cq)U?FXoRTQvqJgXnH0tp<{YM6<|t-HhE&EZmMqp3mK4@zCLoV_qTh>p zO~zXy>8U00<;Cfl@reZmIho0cC7Jnox5Qk$9R1w=wVN;31(i#6GAvB$@!71(r|FFG|$|nOelez`$^eJvFZ^ rvj}J|7f@qLYFc7xPRT9qL}7%DD;bKofGUf)Chuc(V`buD;$s2;tXxAk diff --git a/blango/settings.py b/blango/settings.py index 04c10ce99a..eb618d9b67 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -1,137 +1,169 @@ -""" -Django settings for blango project. +import os +from pathlib import Path +from configurations import Configuration +from configurations import values +import dj_database_url -Generated by 'django-admin startproject' using Django 3.2.7. -For more information on this file, see -https://docs.djangoproject.com/en/3.2/topics/settings/ -For the full list of settings and their values, see -https://docs.djangoproject.com/en/3.2/ref/settings/ -""" -from pathlib import Path -import os -# 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/3.2/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-+sn%dpa!086+g+%44z9*^j^q-u4n!j(#wl)x9a%_1op@zz2+1-' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = ['*'] -X_FRAME_OPTIONS = 'ALLOW-FROM ' + os.environ.get('CODIO_HOSTNAME') + '-8000.codio.io' -CSRF_COOKIE_SAMESITE = None -CSRF_TRUSTED_ORIGINS = ['https://' + os.environ.get('CODIO_HOSTNAME') + '-8000.codio.io'] -CSRF_COOKIE_SECURE = True -SESSION_COOKIE_SECURE = True -CSRF_COOKIE_SAMESITE = 'None' -SESSION_COOKIE_SAMESITE = 'None' - - -# Application definition - -INSTALLED_APPS = [ - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - "blog", - "crispy_forms", - "crispy_bootstrap5", -] -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 = 'blango.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [BASE_DIR / 'templates'], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], +class Dev(Configuration): + + """ + Django settings for blango project. + + Generated by 'django-admin startproject' using Django 3.2.7. + + For more information on this file, see + https://docs.djangoproject.com/en/3.2/topics/settings/ + + For the full list of settings and their values, see + https://docs.djangoproject.com/en/3.2/ref/settings/ + """ + + + + + TIME_ZONE = values.Value("UTC") + + + # 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/3.2/howto/deployment/checklist/ + + # SECURITY WARNING: keep the secret key used in production secret! + SECRET_KEY = 'django-insecure-+sn%dpa!086+g+%44z9*^j^q-u4n!j(#wl)x9a%_1op@zz2+1-' + + # SECURITY WARNING: don't run with debug turned on in production! + DEBUG = True + + ALLOWED_HOSTS = ['*'] + X_FRAME_OPTIONS = 'ALLOW-FROM ' + os.environ.get('CODIO_HOSTNAME') + '-8000.codio.io' + CSRF_COOKIE_SAMESITE = None + CSRF_TRUSTED_ORIGINS = ['https://' + os.environ.get('CODIO_HOSTNAME') + '-8000.codio.io'] + CSRF_COOKIE_SECURE = True + SESSION_COOKIE_SECURE = True + CSRF_COOKIE_SAMESITE = 'None' + SESSION_COOKIE_SAMESITE = 'None' + + + # Application definition + + INSTALLED_APPS = [ + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + "blog", + "crispy_forms", + "crispy_bootstrap5", + ] + 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 = 'blango.urls' + + TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [BASE_DIR / 'templates'], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, }, - }, -] + ] -WSGI_APPLICATION = 'blango.wsgi.application' + WSGI_APPLICATION = 'blango.wsgi.application' -# Database -# https://docs.djangoproject.com/en/3.2/ref/settings/#databases + # Database + # https://docs.djangoproject.com/en/3.2/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } } -} -# Password validation -# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators + # Password validation + # https://docs.djangoproject.com/en/3.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', - }, -] + 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/3.2/topics/i18n/ + # Internationalization + # https://docs.djangoproject.com/en/3.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' + LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' + -USE_I18N = True + USE_I18N = True -USE_L10N = True + USE_L10N = True -USE_TZ = True + USE_TZ = True -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/3.2/howto/static-files/ + # Static files (CSS, JavaScript, Images) + # https://docs.djangoproject.com/en/3.2/howto/static-files/ -STATIC_URL = '/static/' + STATIC_URL = '/static/' -# Default primary key field type -# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field + # Default primary key field type + # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + + CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" + CRISPY_TEMPLATE_PACK = "bootstrap5" + +class Prod(Dev): + BASE_DIR = Path(__file__).resolve().parent.parent + DEBUG = False + DEBUG = values.BooleanValue(True) + SECRET_KEY = values.SecretValue() + ALLOWED_HOSTS = values.ListValue(["localhost", "0.0.0.0", ".codio.io"]) + + DATABASES = values.DatabaseURLValue(f"sqlite:///{BASE_DIR}/db.sqlite3") + DATABASES = { + "default": dj_database_url.config(default=f"sqlite:///{BASE_DIR}/db.sqlite3"), + "alternative": dj_database_url.config( + "ALTERNATIVE_DATABASE_URL", + default=f"sqlite:///{BASE_DIR}/alternative_db.sqlite3", + ), + } -CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" -CRISPY_TEMPLATE_PACK = "bootstrap5" \ No newline at end of file diff --git a/blango/urls.py b/blango/urls.py index 4141d41de4..21dc0efc75 100644 --- a/blango/urls.py +++ b/blango/urls.py @@ -16,6 +16,7 @@ from django.contrib import admin from django.urls import path import blog.views +from django.conf import settings diff --git a/blango/wsgi.py b/blango/wsgi.py index 83565cf12c..50fe8ff186 100644 --- a/blango/wsgi.py +++ b/blango/wsgi.py @@ -9,8 +9,11 @@ import os -from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blango.settings') + + +os.environ.setdefault("DJANGO_CONFIGURATION", "Prod") + +from configurations.wsgi import get_wsgi_application application = get_wsgi_application() diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index d3d9217f7c28dfe78400107d4b8ccda67c6eafd7..9f00c9725169a872a6b098e264aa1519f0306cf5 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=yz6Ma09y%GQ!`UA)S delta 15 WcmZo*Y+z(J=H=z`e0g^wdnEuJhy;NE diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 9569d490ef017e3bfcbb409d1b21d29d61e094b6..0d818358554ea63aa291fe755fd8e24949944529 100644 GIT binary patch delta 16 XcmZo{FQmCT#@r diff --git a/blog/__pycache__/models.cpython-36.pyc b/blog/__pycache__/models.cpython-36.pyc index 360fd3f8933965e04b324682f6e97820a099c04c..5f183ff73c70259bd586cf600597c5ba30609061 100644 GIT binary patch delta 106 zcmZqRYv5xy=H=yz6Mejq-G-U*)?^oE2gX~QTbcbBft)KW>$nvd7#NBaL4?xeURH4h z4IuLtXK+qwx?5&yPRcEoVjwe$y|^?tH?gR)NOtlOR$oTt$wF+(K+=qDB9J`6W&r?1 CEFQrC delta 106 zcmZqRYv5xy=H=z`e0g^xyA3mA)MOWC2gaz)t;~LmK+YAGb=-0c3=Bo`AVOhsFRQqM zDv)`LGdQO--7PaUC*>APF_0O>UR;`+n^;s?Bs2L4t1qMCWFa?fH7Z}BDP=ar=9mBi;KWu+#U+?xE5sfJN*avXCqkUYd} F0s!2@5?ufQ diff --git a/blog/migrations/__pycache__/0001_initial.cpython-36.pyc b/blog/migrations/__pycache__/0001_initial.cpython-36.pyc index 45ab54c88b9168e5e10875b5e4b6dc6a165318c8..61ffda122c9aa12cc4e15ccba4b4d5c90e34a811 100644 GIT binary patch delta 16 XcmX@ld7hKqn3tC;PW16c_7f}sDFy`T delta 16 XcmX@ld7hKqn3tE!^X1)*>?c?NElmZY diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc index b5ff8850513bb0a762df850b74903d2cbd0771a1..fa349f29313f1b6c09399e13e1a25938bcab50d3 100644 GIT binary patch delta 16 XcmeC?=;mNI=H=yz6MejqorMJeA8G@e delta 16 XcmeC?=;mNI=H=z`e0g^xI|~Z{Be4Wj diff --git a/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc b/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc index a4bea77856c2c219a34871411457d0c4ab19c47e..865e49f7f5a5d0c338ff15d03562d9a5ab9eb697 100644 GIT binary patch delta 16 XcmaFM`j(a5n3tC;PW16c_Ge50EK~(K delta 16 XcmaFM`j(a5n3tE!^X1)*?9Z40Fq;MP diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index 5b5391c7df1d6e1602786adcb3a54a0942b180cc..c6e4f76d36a522d09400bdfc91c3bb6847b17024 100644 GIT binary patch delta 15 WcmeBX>}F&)=H=yz6Ma09y#)XpIRohc delta 15 WcmeBX>}F&)=H=z`e0g^wdkX*_#{{AP diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 780f0dca5ca23215b39b6c8bd3223896f318f921..981da489d35d8ba2d8abcb62edccd0de7df1fc06 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=yz6Ma09y$t{xa|7=H delta 15 WcmeBW>}6y(=H=z`e0g^wdm8{B0R*T3 diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index c0dbaf03dbc2e962b867002713d5f9b922a3bfac..7bda3981bab5e7de9c2525ce95e7f1f596e34697 100644 GIT binary patch delta 16 Xcmcb}dy$vjn3tC;PW16c_ET&CDYyjr delta 16 Xcmcb}dy$vjn3tE!^X1)*?5EfOE&m0w diff --git a/manage.py b/manage.py index c66b327f71..0fee295e18 100644 --- a/manage.py +++ b/manage.py @@ -7,8 +7,9 @@ def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blango.settings') + os.environ.setdefault("DJANGO_CONFIGURATION", "Dev") try: - from django.core.management import execute_from_command_line + from configurations.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " From 2b53f871e904bd62bdc0140d13304b2561f6af48 Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Sun, 15 Sep 2024 02:25:55 +0000 Subject: [PATCH 08/15] Finish logging --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 3462 -> 4058 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1077 -> 1077 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes blango/settings.py | 39 +++++++++++++++++- blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 513 -> 513 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1014 -> 1200 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1745 -> 1745 bytes blog/views.py | 37 ++++++++++------- 18 files changed, 60 insertions(+), 16 deletions(-) diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 88e558c4a689507d8b7be5b904e350fdfc705814..8401b37ffe1f3a1cc5005001acf49cab510684e3 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=z$b$K?Cy&3=+MFXz@ delta 15 WcmZo-Y+__L=H=yz6Ma09y&3=-Gy~26 diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 7f1cbaf31841fba9c26deca1db7f22d7a705b119..ac03e8c5149344b31fdfbaae21a2b9b2ded5e898 100644 GIT binary patch delta 1212 zcmZWnOK%%h6rMW|znwUK#BJTwiIcXTHgSMLp@AlC@gtGaRB|aucVk`WTu;Xud&1mt z)H+o^v$cm4b5OK{}oI zq49g~*X4`EkCTL=C{Hj%k0=UPC;^44K&S>PXrO}u5u4Zqq7Z{PBxWk+Nl0Oxo@uZE zi=bNsGMF#TRLDXOs|CnIVWuH-8LJ{(!<*}~DAl>qkHC#{LZdv!@p7@!zb_%K84RL9Xo$C!@1~9 z*r6-%IefuW@VKPFuAHCVf<1VGoIQ9N;H z<1VbeRLuQAtMgOVBA4&U0h#=PyH}bt=kaexw#PfbyCbX9V~*fswQ7zl&}T!-t&M!! z5jDrPYVA3*E{RRa3!$)h|J9GFccZO`h->sf8aqQb+HgI9&$fFa_J?28}0OtN{ zkFyDc`2Y`@#ozr!&P+9k^jvSi{J;?YTZfMe_^M?Ot=dZ;6@z^?1c!U$41eSAY;TLV zq9%NBN4}{A#<9bM2qGe62JyL(&%MBCwA(M*{~Kpw)tGHSO1&K6d3yo<%v0M8d z(^yJZRia|Vbo`Q-Au*y!#4Do9GhHXC$mLIoeL~99Ka-Dk%cu;JOm1t)eEXCinK`c_ zo!2F7NKhr167EU3FJV(cVS19lQ@7Q!zWB99Ow8EiE{@T+FkY}j_lFyr3#w3yy3A4!cNK?>(S|JpXE-Sj$n F_&5ELN#g(j delta 604 zcmZ9I&2G~`6ouzHb`slh>^N!uoHT8dwh3wZQHlf-iV!M-N(}A;ShsDR9jDh$~Q z<1Tbwgz^7eq)Vc=AykGb5+<))BL@q4*l7&KO9J delta 16 XcmdnWv6X|}n3tDpmi6O}?0PH!Co%+k diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index 9f6fa5c9c153d3aaf1cb5ceef75a2f688f1299a0..8f1b49369808258cb379bbb9c00c587e0639a78c 100644 GIT binary patch delta 53 zcmeBV>11Iy=H=z$b$Pat-IbB?)?{DCa48lB28LVQi3J5YnaPPInfZAu8H%`oVntk& I_c3|{0ClzwmH+?% delta 53 zcmeBV>11Iy=H=!3t^0T*yDKAO)MQ`Aa4BX628LVQi3J5YnaPPInfZAu8HzZ8Vnv*j I_c3|{0EiY2=Kufz diff --git a/blango/settings.py b/blango/settings.py index eb618d9b67..646d0da242 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -20,7 +20,44 @@ class Dev(Configuration): For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ - + LOGGING = { + "version": 1, + "disable_existing_loggers": False, + "filters": { + "require_debug_false": { + "()": "django.utils.log.RequireDebugFalse", + }, + }, + "formatters": { + "verbose": { + "format": "{levelname} {asctime} {module} {process:d} {thread:d} {message}", + "style": "{", + }, + }, + "handlers": { + "console": { + "class": "logging.StreamHandler", + "stream": "ext://sys.stdout", + "formatter": "verbose", + }, + "mail_admins": { + "level": "ERROR", + "class": "django.utils.log.AdminEmailHandler", + "filters": ["require_debug_false"], + }, + }, + "loggers": { + "django.request": { + "handlers": ["mail_admins"], + "level": "ERROR", + "propagate": True, + }, + }, + "root": { + "handlers": ["console"], + "level": "DEBUG", + }, +} diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index 9f00c9725169a872a6b098e264aa1519f0306cf5..89b1614a4532a851f4305945977a0a3a2902b80d 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=z$b$K?Cy%GQ!3j?VD delta 15 WcmZo*Y+z(J=H=yz6Ma09y%GQ!`UA)S diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 0d818358554ea63aa291fe755fd8e24949944529..061d1e5a8fbf8a1d8dd67780c8aefd69e2d06d0b 100644 GIT binary patch delta 16 XcmZo$nvd7#NBaL4?xeURH4h z4IuLtXK+qwx?5&yPRcEoVjwe$y|^?tH?gR)NOtlOR$oTt$wF+(K+=qDB9J`6W&r?1 CEFQrC diff --git a/blog/__pycache__/views.cpython-36.pyc b/blog/__p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dU%dDQ$S@4|tE$3UG0%?tYE`4D!kpQ+?@ zQe+&2lT$Gsq*bX!sgqle#?690O(R=(&%y%>o3_wPtN9#+oj12Iu=&thop7NiSrI}) zJpw=^B0dgq02pBx`!FFx7?F?R^dOF!KlIbv&dn}!r>pf|cCG!rdBvB7*tb833IH~t J8%*Lm{{ZuHhk5`2 diff --git a/blog/migrations/__pycache__/0001_initial.cpython-36.pyc b/blog/migrations/__pycache__/0001_initial.cpython-36.pyc index 61ffda122c9aa12cc4e15ccba4b4d5c90e34a811..83970d9e125bd317fe9a0af318133a73a0b3f682 100644 GIT binary patch delta 16 XcmX@ld7hKqn3tD}*X7wp_7f}sC-?-) delta 16 XcmX@ld7hKqn3tC;PW16c_7f}sDFy`T diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc index fa349f29313f1b6c09399e13e1a25938bcab50d3..cee1cf7ebb1b9e8ecb1ec092e6b7be5fb73bda0a 100644 GIT binary patch delta 16 XcmeC?=;mNI=H=z$b$PatorMJe9$W)_ delta 16 XcmeC?=;mNI=H=yz6MejqorMJeA8G@e diff --git a/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc b/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc index 865e49f7f5a5d0c338ff15d03562d9a5ab9eb697..98f70d1e9550dd86aabc5141f4652b89830fc744 100644 GIT binary patch delta 16 XcmaFM`j(a5n3tD}*X7wp_Ge50D@Fwx delta 16 XcmaFM`j(a5n3tC;PW16c_Ge50EK~(K diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index c6e4f76d36a522d09400bdfc91c3bb6847b17024..0e047272a1c39ecacefc436d6d826dbbfef7bbef 100644 GIT binary patch delta 15 WcmeBX>}F&)=H=z$b$K?Cy#)XoN(0IO delta 15 WcmeBX>}F&)=H=yz6Ma09y#)XpIRohc diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 981da489d35d8ba2d8abcb62edccd0de7df1fc06..bcbfd2bfdf26c3c81a77677ded836ce08250749b 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=z$b$K?Cy$t{wgagn3 delta 15 WcmeBW>}6y(=H=yz6Ma09y$t{xa|7=H diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index 7bda3981bab5e7de9c2525ce95e7f1f596e34697..7d7af3fb9b62f8648f50a90af7d5338461996f5f 100644 GIT binary patch delta 16 Xcmcb}dy$vjn3tD}*X7wp_ET&CD5?b7 delta 16 Xcmcb}dy$vjn3tC;PW16c_ET&CDYyjr diff --git a/blog/views.py b/blog/views.py index 926ec5127a..ab404f4cce 100644 --- a/blog/views.py +++ b/blog/views.py @@ -2,29 +2,36 @@ from django.utils import timezone from blog.models import Post from blog.forms import CommentForm +import logging +logger = logging.getLogger(__name__) + + # Create your views here. def index(request): posts = Post.objects.filter(published_at__lte=timezone.now()) + logger.debug("Got %d posts", len(posts)) return render(request, "blog/index.html", {"posts": posts}) def post_detail(request,slug): - post = get_object_or_404(Post,slug=slug) - - if request.user.is_active: - if request.method == "POST": - comment_form = CommentForm(request.POST) + post = get_object_or_404(Post,slug=slug) + logger.info( + "Created comment on Post %d for user %s", post.pk, request.user +) + if request.user.is_active: + if request.method == "POST": + comment_form = CommentForm(request.POST) - if comment_form.is_valid(): - comment = comment_form.save(commit=False) - comment.content_object = post - comment.creator = request.user - comment.save() - return redirect(request.path_info) + if comment_form.is_valid(): + comment = comment_form.save(commit=False) + comment.content_object = post + comment.creator = request.user + comment.save() + return redirect(request.path_info) + else: + comment_form = CommentForm() else: - comment_form = CommentForm() - else: - comment_form = None + comment_form = None - return render(request,"blog/post-detail.html",{'post':post,"comment_form": comment_form}) \ No newline at end of file + return render(request,"blog/post-detail.html",{'post':post,"comment_form": comment_form}) \ No newline at end of file From ce185e149299cdacf86774b70fc801d4b61cd86e Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Tue, 17 Sep 2024 15:46:07 +0000 Subject: [PATCH 09/15] Finish security ad passwords --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 4058 -> 4559 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1077 -> 1077 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes blango/settings.py | 20 ++++++++++++++++-- blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 513 -> 513 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1200 -> 1200 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1745 -> 1745 bytes db.sqlite3 | Bin 184320 -> 184320 bytes manage.py | 2 +- 19 files changed, 19 insertions(+), 3 deletions(-) diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 8401b37ffe1f3a1cc5005001acf49cab510684e3..4df9eb57564db4b92b538be27304c0755f46c5c0 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=y*uYNI+y&3=-%mexW delta 15 WcmZo-Y+__L=H=z$b$K?Cy&3=+MFXz@ diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.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Wzq%)Wh>`*(?oTnZLNF zPEXpYyQiVupkKc3TOz~Ml;Nk)cWxEr>6)ZbuP=wiX&t1`3sz%*cBR@bwfl3H^-l$TRpb@7b@qWT>t<8 diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index 159f2cb374407133e9ec622644f4178c03c7cbb9..bfa44ed8f4811817a699519f73fe8f462f3d94d3 100644 GIT binary patch delta 16 XcmdnWv6X|}n3tDJzWT*Rc0CpVC2j;o delta 16 XcmdnWv6X|}n3tD}*X7wpc0CpVBb)>J diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index 8f1b49369808258cb379bbb9c00c587e0639a78c..b3aeab310bcc2f57109de13376a9d4edff8fffdc 100644 GIT binary patch delta 16 XcmeBV>11Iy=H=y*uYR$SorwtmAAAG1 delta 16 XcmeBV>11Iy=H=z$b$Patorwtm9jXIt diff --git a/blango/settings.py b/blango/settings.py index 646d0da242..06e70f5065 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -3,10 +3,16 @@ from configurations import Configuration from configurations import values import dj_database_url +import argon2 - - +PASSWORD_HASHERS = [ + "django.contrib.auth.hashers.Argon2PasswordHasher", + "django.contrib.auth.hashers.PBKDF2PasswordHasher", + "django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher", + "django.contrib.auth.hashers.BCryptSHA256PasswordHasher", + +] class Dev(Configuration): """ @@ -20,6 +26,16 @@ class Dev(Configuration): For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ + + + PASSWORD_HASHERS = [ + "django.contrib.auth.hashers.Argon2PasswordHasher", + "django.contrib.auth.hashers.PBKDF2PasswordHasher", + "django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher", + "django.contrib.auth.hashers.BCryptSHA256PasswordHasher", + +] + LOGGING = { "version": 1, "disable_existing_loggers": False, diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index 89b1614a4532a851f4305945977a0a3a2902b80d..925fec6f75b7d4eee0b58ef522ecac0ed1810143 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=y*uYNI+y%GQ#k^}Sr delta 15 WcmZo*Y+z(J=H=z$b$K?Cy%GQ!3j?VD diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 061d1e5a8fbf8a1d8dd67780c8aefd69e2d06d0b..e077cd63c292c2a2bbae0583869f47b7b5c8b19d 100644 GIT binary patch delta 16 XcmZo}F&)=H=y*uYNI+y#)Xp(F7F$ delta 15 WcmeBX>}F&)=H=z$b$K?Cy#)XoN(0IO diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index bcbfd2bfdf26c3c81a77677ded836ce08250749b..6f508a995e9e35db4e927f1b1b564674ad5e0d73 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=y*uYNI+y$t{y3j`Yg delta 15 WcmeBW>}6y(=H=z$b$K?Cy$t{wgagn3 diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index 7d7af3fb9b62f8648f50a90af7d5338461996f5f..377ac6eb11b273e7403b27b2b975bf62cb7ef098 100644 GIT binary patch delta 16 Xcmcb}dy$vjn3tDJzWT*R_ET&CDtrYc delta 16 Xcmcb}dy$vjn3tD}*X7wp_ET&CD5?b7 diff --git a/db.sqlite3 b/db.sqlite3 index 6c73078825882784efc88f4fb0dabe037adac27a..4a03aca700ae897e30554918a9236104eba3cf4e 100644 GIT binary patch delta 724 zcmah`O>fd*0H#t83v{n~Q;b0$Bc4{%4_)EF&F*hE$h~X%P6Sk4YO}U80sVR<7x|LQFxqm@bb(=xxcWXgN zBAO)U^&pyW2Yv36TxjJZaVZN$D_4h&oXj!uinx-ZVwS|Y71kWEnKY9~n*2s3o2bZ= zCTL_Ole2QmdDDu7T8#lrswzJlLl?;&((i%n3}gZ{3NUDaMI_Bqg;qoDm+E`Zn>TO# zVIi|Xd1=;1PtG;siW3K?HgF2Qf-~@Ka((Lr5ceE*7xvqVPtJz!YfjwJuuXp=j-0!W z#(4DDF?=zLUrlXGTwCo`k=`Z^1fjprGQE1W@2`6+ilw8jwW%+Zs{)mK=qSX~l*y#VZWlw>cU_~}&CD9LK5SYC~;dP0I9 zn)PB;@^zJne7`7GW2J6V8q}yl_~!wT^pNnc1AGkQg_GU=p8aBC%?4h9&)^tn=q|62~f6z#pY-JU%+a#77r7J2vnIoPf7rXFM{%-8*&;`*%5hN$>5yxpn;E IJNEG74}-GZx&QzG delta 166 zcmZozz}>KbdxA8h^F$eEM(2$QzWR*Jo7d@w8E`T4erMoY$)CXcePiQG-p${0d6~GF z`5!Rwzv6$u|828i!%==-H3lTG`9Zyk02edQL diff --git a/manage.py b/manage.py index 0fee295e18..b509d4d7ac 100644 --- a/manage.py +++ b/manage.py @@ -15,7 +15,7 @@ def main(): "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 + ) #from exc execute_from_command_line(sys.argv) From 4cfc7fbdbc37be3c1818dc25071d2361b30f22d6 Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Fri, 20 Sep 2024 19:06:08 +0000 Subject: [PATCH 10/15] Finish caching --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 4559 -> 4559 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1077 -> 1077 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 513 -> 513 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1792 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1200 -> 1350 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1745 -> 1880 bytes blog/templatetags/blog_extras.py | 5 +++++ blog/views.py | 7 +++++++ db.sqlite3 | Bin 184320 -> 184320 bytes templates/blog/post-detail.html | 6 ++++-- 20 files changed, 16 insertions(+), 2 deletions(-) diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 4df9eb57564db4b92b538be27304c0755f46c5c0..8439029ea98ddbdef7c5e1910d6974bdb9d93eec 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=yjzwPZr_G$ni=LHG? delta 15 WcmZo-Y+__L=H=y*uYNI+y&3=-%mexW diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index b2f7da2e687db4897d5fc2dbe157e9d54ea97d95..406b6280289a67fa4be027a1bec13ea784e60dd9 100644 GIT binary patch delta 23 fcmX@Fd|sK|n3tF9{kFFo*^jX@{@Q$wm5~PkZ0QK* delta 23 fcmX@Fd|sK|n3tF9^`e&>*^jX@-r9VQm5~PkYP|@m diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index bfa44ed8f4811817a699519f73fe8f462f3d94d3..6a41db90e45f8fa0e1343c288138374904acc5a2 100644 GIT binary patch delta 16 XcmdnWv6X|}n3tF9{kFFo+4WceESUvW delta 16 XcmdnWv6X|}n3tDJzWT*Rc0CpVC2j;o diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index b3aeab310bcc2f57109de13376a9d4edff8fffdc..6e13468d7cbf74f21ed8f5d49324cd51fb62f180 100644 GIT binary patch delta 16 XcmeBV>11Iy=H=yjzwPZtb|xkOCZ`0) delta 16 XcmeBV>11Iy=H=y*uYR$SorwtmAAAG1 diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index 925fec6f75b7d4eee0b58ef522ecac0ed1810143..be51965a7d8643bbb1c250dca7406d6713788a52 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=yjzwPZr_DTRCtpx-C delta 15 WcmZo*Y+z(J=H=y*uYNI+y%GQ#k^}Sr diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index e077cd63c292c2a2bbae0583869f47b7b5c8b19d..c18f49efea780cc6d593b4f198534b7e9e6b9145 100644 GIT binary patch delta 16 XcmZo24F-?;uwrTta3Sv*itO9;8MrY5~|i4|8<+)F-% zQw6_62R9douFkHyde_A+-tqo;@41J&=Y1)Tv|7_JwBhLMx;cx`Cz@I^@Ar8nkAvF5 zajd&KAdIjQm14s+CVe3?U6YvYIa1ERtq>in84v>(vDQZ!aLvLxF7=UH#f3}c7=x#a zO$WwW;0HIv>-sIiPiD_&4<7A!0j0MgIS=cA(BR`;)%fqvh*|j%wkxKHqHrMDf-*4s z^&1=jGhdVHu#lfgM>`dM$>s%?1eQ6*g@DE}>7>jO(ganZ>s^|p9wwFRJ5xBX6wHhLksPa2p6l=&%TNn?_msod$V{O1wVuws5Hub+s_%oY%jPeu64 cq3*^M-$i7P&x{h`wV@>Tj3^Z}Spif11s-%^%m4rY delta 280 zcmX@cwSiOFn3tDJzWPPlA{GXQ#|%h-3CMN;;^Mf8%8p7=T&Y}H+^Iaxj8VKPY$@z5 z3{iY394VYYnm>g#m_d_k;wpbezsd597dbe9x>hn22~7UMXeP)7GJ*|AFfa-+3NRK4 zZMJ99WMt%-oXM=iC^C5(vx_A^P_jrEM2LY1aUgMvJvl!&H#M)MNB|@RCIms^+y(i? zCGjb#C5f3i0+WSV)Y+7Q!kPk;9athJ-)E6?<^ib}0udkyB<%<@IBatBQ%ZAE?HGY7 Tiur(q2qO;|axikSaIgUYy?Qep diff --git a/blog/migrations/__pycache__/0001_initial.cpython-36.pyc b/blog/migrations/__pycache__/0001_initial.cpython-36.pyc index c9ab26da1a47eb3294380a5ebb4ab157ae9ef295..3263a2b40a056c5585297514f1ab59c8a46e24a9 100644 GIT binary patch delta 16 YcmX@ld7hKqn3tF9{kFFo*-x+l05J6iB>(^b delta 16 XcmX@ld7hKqn3tDJzWT*R_7f}sDar*E diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc index 2a42edb289ccb3bcb6ef631170fb9444f739a134..c2a13b97e8691f49162fd0498912503ad0c6ec76 100644 GIT binary patch delta 16 XcmeC?=;mNI=H=yjzwPZtb`}-@Cs_p7 delta 16 XcmeC?=;mNI=H=y*uYR$SorMJeAT9&P diff --git a/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc b/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc index 9e3fdb9f813c0656da633c3833f077534c330d67..fe4f23ca81f43b6bf97f3cf94da8069477cdd713 100644 GIT binary patch delta 16 YcmaFM`j(a5n3tF9{kFFo*`F~105n4ebpQYW delta 16 XcmaFM`j(a5n3tDJzWT*R_Ge50Ef@u5 diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index bc708fef2e1aa173fa02c46d8631d77a2a2b9de5..21ad3bbd5c93475c6dca7e4362f514b83a1fbe1f 100644 GIT binary patch delta 15 WcmeBX>}F&)=H=yjzwPZr_7(sk>;)wN delta 15 WcmeBX>}F&)=H=y*uYNI+y#)Xp(F7F$ diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 6f508a995e9e35db4e927f1b1b564674ad5e0d73..b97178a051c6a8b0385ec8fbfe8ed1e1b7cf8258 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=yjzwPZr_BH?_CIu@1 delta 15 WcmeBW>}6y(=H=y*uYNI+y$t{y3j`Yg diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index 377ac6eb11b273e7403b27b2b975bf62cb7ef098..26fe9f49f128851f8815652f9ba8b174970f2d4f 100644 GIT binary patch delta 559 zcmYjNziZn-6ux)TDT*!0KO#G}38|Nhv1OG zX_t~A+}bYf(ElSt#zMECsnDrI|Aa!H5x% z?j4i*7gXu(b${mq8Ct_?Se4bpk?ssaPeM|gv9K-;!iKCTOP>K*FaiF%W1HL;itx**RopBGAaJDJ3o3nE?#VDWLew z57@xk8$ixa-~ACZb~>-wX3?5~k90A=61diqAZUoG~%9mV-#EVJGDZaa!bhbJDixXVQ&(S#_m6I&5Oz(%yOOA|127Ez*X5)l+Ek~T%y*2>aG z3$d~DAJ|DcvC#YiTjx#$7v}MO-^}dHoAYW{Hf%dly8Jr2*BSd@|DHzqHd*g+QfXX= z&`AzilZPsKJLDY)^JtmP=(2F?_{R37j%%Xj2FtsM%J8}zdAt~RX1+J_sUGU_C(t>&Es_O}r>Kf6qWx1;^ z1gKsCYBvha(D$idIXj-weM~;7rA1Aclupgl!%o=l_oile(LNbqDBP&R(AH9=Xi{`P zQvwiqS=U~`mzq8<6o_l`_CScR+iwkep%6Y%qA2h5O{mIGebuWHL7xhX;$QG(**KTa j#-5Rn%Byl&3FM0DEENfI;NX&R)dEA&fNPHa>odj=Ubk13 diff --git a/blog/templatetags/blog_extras.py b/blog/templatetags/blog_extras.py index 673d369f8b..b05c9dae3d 100644 --- a/blog/templatetags/blog_extras.py +++ b/blog/templatetags/blog_extras.py @@ -3,6 +3,10 @@ from django.utils.html import escape,format_html from django.utils.safestring import mark_safe from blog.models import Post +import logging +logger = logging.getLogger(__name__) + + register = template.Library() @@ -31,6 +35,7 @@ def endcol(): @register.inclusion_tag("blog/post-list.html") def recent_posts(post): posts = Post.objects.exclude(pk=post.pk)[:5] + logger.debug("Loaded %d recent posts for post %d", len(posts), post.pk) return {"title": "Recent Posts", "posts": posts} diff --git a/blog/views.py b/blog/views.py index ab404f4cce..a331d08e6e 100644 --- a/blog/views.py +++ b/blog/views.py @@ -2,12 +2,19 @@ from django.utils import timezone from blog.models import Post from blog.forms import CommentForm + +from django.views.decorators.cache import cache_page +from django.views.decorators.vary import vary_on_cookie + import logging logger = logging.getLogger(__name__) # Create your views here. +@cache_page(300) +@vary_on_cookie def index(request): + posts = Post.objects.filter(published_at__lte=timezone.now()) logger.debug("Got %d posts", len(posts)) return render(request, "blog/index.html", {"posts": posts}) diff --git a/db.sqlite3 b/db.sqlite3 index 4a03aca700ae897e30554918a9236104eba3cf4e..9db6ccb039887951cdc5f78ccdd8caf02e2c33b6 100644 GIT binary patch delta 603 zcmajbO>fe00LSr?trsTz&x>X=IukEl{(Yoyq7+&lHaZGzX)hg69$M&lXrX|KTU~Z{ z?x2a69gK;mg)EU5;MIe7J(>6#JgV_xVq*NgfbTE)oLz67U2i?V8!27h<0GZj@mn*R zM&j?laqN36y$W|?+aHm?7gC!sB;>CM7b-QOUR@4!9pY5ACL0xq+d7oTRc$^hclT<3 zQ0EI)hA-PeUBHzJK`dq*0SO9&NsNH^aW(~+6rS8CX_{n`#&BRQTK%i1C)>B*+}#Ip zG%6tR&$0J+F1H3zVHHx*(`OG+^zdBarfr|`$tBA;mPb&1x<7RYYSe2r`rVQ3u#5e6 zajrVKoD|qxMQ)os(c?-%z)i`zCvsj{84q=Lq(URX(B-M0^*flE98kTHM$B50ot&4Z z1+P+^V?Mnc1{%!MMxxO)PIc&$n&J6@+P1jqggolem>QS?J!WQVv!4{C2By#%(U--* z%jRsy5rm1xOBq9NX53=VEOZwh=7@``jKQUNkhRT*9^~aK;Xo_WT2d`gk#!-+*zzgsN ztbq&itB?VY_BIY9|HDJi-J7+06M32bRp=n#EBFB3fD6!Bg*C9dv%y9FeT=Rzeng&p F`UydXw*&wH delta 233 zcmVQDN0A&u0Y|Z5re6vx01l}SU=8;TE3tta4F`cq1PuUzZIefB zFlts>Z&yZ2Q&KTbcU5aKY*ki4HC9wkR82EUcT+(mVK;VqH&IVDOH6h{VrNoIXI4{f zNNq4@QB`+UP*-+$MnZ3FdNE97WJ5_ZFfuePFgYzTHy|-JIy5pmH8L(YGB7kZGg@zK zWO-w2lYVX)v*m3cA`AozYyb}14YmxC3v980Tnn>oo0tR)1P^Th50Veu54R6(v4LF= jgKe+3ZLa~BKnw&Ag#ZuY55o_n4~4OTbq}|N{{ef@BDG7T diff --git a/templates/blog/post-detail.html b/templates/blog/post-detail.html index d23fe4b0a3..a87e0deb0b 100644 --- a/templates/blog/post-detail.html +++ b/templates/blog/post-detail.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% load blog_extras %} +{% load blog_extras cache %} {% block content %}

{{ post.title }}

@@ -17,7 +17,9 @@

{{ post.title }}

{% include "blog/post-comments.html" %} {% row %} {% col %} - {% recent_posts post %} + {% cache 3600 recent_posts post%} + {% recent_posts post %} + {% endcache %} {% endcol %} {% endrow %} From dff093cec8237b927a646b457458dfbf7728b4da Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Tue, 24 Sep 2024 21:42:16 +0000 Subject: [PATCH 11/15] Finish database optimization --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 4559 -> 4668 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1077 -> 1200 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes blango/settings.py | 6 +++-- blango/urls.py | 12 +++++++-- blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 513 -> 513 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1792 -> 1822 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1350 -> 1563 bytes .../0004_alter_post_published_at.py | 18 ++++++++++++++ blog/migrations/0005_auto_20240924_1811.py | 23 ++++++++++++++++++ .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes ...004_alter_post_published_at.cpython-36.pyc | Bin 0 -> 599 bytes .../0005_auto_20240924_1811.cpython-36.pyc | Bin 0 -> 669 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes blog/models.py | 6 ++--- .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1880 -> 1880 bytes blog/views.py | 9 +++++-- db.sqlite3 | Bin 184320 -> 192512 bytes 25 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 blog/migrations/0004_alter_post_published_at.py create mode 100644 blog/migrations/0005_auto_20240924_1811.py create mode 100644 blog/migrations/__pycache__/0004_alter_post_published_at.cpython-36.pyc create mode 100644 blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 8439029ea98ddbdef7c5e1910d6974bdb9d93eec..7d90761b1b3c107eb20ca16808cb484d78ba6eed 100644 GIT binary patch delta 14 VcmZo-Y+__H=H=zGJUfxC1^^c91APDh delta 14 VcmZo-Y+__H=H=yjzilF04FDP*1RMYW diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 406b6280289a67fa4be027a1bec13ea784e60dd9..d0b50a713d08930984e6da0566c23bad85c2a3dc 100644 GIT binary patch delta 549 zcmY+9KX21e6vcg?9oKQ=IEfGxLdu_n&>%3018EC1(2%q-ln~KQ51}g6F;A&VBN-49 zLSpF5fIK!GSdbVPP*%PJV(rF+SQz*OJf{_?!}+~?&pYqw-f#J@1+!{d=Jc;WPsPbE z<}T5j@FV?vi?T5JDOBL1ifg!zn$UR`v-~vXd<*kgMG&TN12=IC3#bdNPq;nQ1o0g1 z@M$cfA#-=L3YtUKCw>MkEXhm@%VW03^!g+;eirxmIZW~MQhBKYviJD~tneZp@QYG2 z=*W*tD6A@_hohWYkJ;RUzwuJ6zZeX*HhMw$*mz&Odc<;`^?@z_RWIm_3 zT+O^rR_0x&Qk!!sWyf`ErAwoQ#0)#JpYS?stw){3m36PX`bi0v6-6T4PS$A{eoj8o z8R;scFk$B@9+vInVbg91+97WE@y*E{g(u``fkA~PROu&WZzJYU>?+XrA}8giH#7eo zOuVD9V;p+%Jym)P=8*9eCgs+NeXSb|F#2uhX!c;F@mvww5j=_SQqPY`7?dK7Op+(d pu#Bu31zy-lS1)(vHP?HA7;L*iQ8qy=LiGG_)qhnx{E)svjlXxiiG%Qa%`w`;) zqZq?D@|dtSp1>sU##Gh9bV9KS;+VlK<}i;1o7D&w8_Xs=i30Dz5{fdnoKUdRpf$pK zv5GaBS;e}?lE-q5*o^m~!ut{D15zoeG&cAkqMLjOTRbC`MS4%kZ8tM&K@(^G>*kcP zqtaZic^k}9<56)+iXtK2Lj`gpV&Ma-tKvMIikZ6Vj_GHNQ8_x(7!@z!m1BBIxW8(g z1TGaGl&=L944SP(o(d?njcO^QWIz(nZ-tMWQ9Hqe)T`PtpAFj@-F^=-Bnsac9U)Xn(Qa|GBGosVqVr HBc%8ZlCf$Z diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index 6a41db90e45f8fa0e1343c288138374904acc5a2..ffc566af9ee6009012a4f75dc9421841acbd10b5 100644 GIT binary patch delta 437 zcmYk2Jxjwt7{~7=mt51NwpK*M#YG5$9SS;$B8r=fxZD!b-ZduVrCd_QE(%>-1fhNj zHyvEu{2I3^xcdpbL{RVH?)m?J_dLh(ywIn{b>DUEx6iN9wgJF9__wIm`+64-`rv>8 z4mnC7gF52`rI=w@F(WZj!bq)2Vx|_eQp#xUQPND(W(%KSs?8dEHQ?Xl_ zh1xXgi#E4;^A3jw>j)e#%6rk#O^%=f>IdKqg>VP34o9cJbDwXoQ2)e(iWZ_Qqbw}6 zCIL^Q%tOi;2j#i4qHLHTbab>4B~^Cd5;h@%-(3=Lv;Y7A delta 353 zcmYk%Jx;?g6bEqIdHHUk;tmWIQWrKBH~|Y{@ewl8&c5D0mk$9UALL()(I+_U1x|u+BB)@RHjFdcJJ3M` z90r39d4zkRj+=xhlt>VfWOZ6+_Y57&sLt!r;AHSvq#}C^sx;s`0?x=Ze|f)U`%~(} zQZ%YXz`As+Q$%8=bE>WET{N6+SHZz%y6fYj5Z$6E@P@iX3U zwgx{(csAEvHM>&s+Ir~ySA)T&fj$LRIq9Jf`S7PSRIQLVJYRR#6+*gFX`gS8AWxr& WnPA9Fw&!rXw}S*a!k*Ak*stF>;$5i# diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index 6e13468d7cbf74f21ed8f5d49324cd51fb62f180..4116ea3aaa01707348f5535ded7992a2ed94faac 100644 GIT binary patch delta 15 WcmeBV>11Iu=H=zGJiC#NnF#11Iu=H=yjzilHMGZO$F+ymJF diff --git a/blango/settings.py b/blango/settings.py index 06e70f5065..8bfef5a977 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -115,11 +115,13 @@ class Dev(Configuration): "blog", "crispy_forms", "crispy_bootstrap5", + "debug_toolbar", ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', + 'debug_toolbar.middleware.DebugToolbarMiddleware', #'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', @@ -157,7 +159,6 @@ class Dev(Configuration): } } - # Password validation # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators @@ -203,10 +204,11 @@ class Dev(Configuration): CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" CRISPY_TEMPLATE_PACK = "bootstrap5" + INTERNAL_IPS = ["192.168.10.226"] class Prod(Dev): BASE_DIR = Path(__file__).resolve().parent.parent - DEBUG = False + DEBUG = True DEBUG = values.BooleanValue(True) SECRET_KEY = values.SecretValue() ALLOWED_HOSTS = values.ListValue(["localhost", "0.0.0.0", ".codio.io"]) diff --git a/blango/urls.py b/blango/urls.py index 21dc0efc75..3725147eec 100644 --- a/blango/urls.py +++ b/blango/urls.py @@ -13,15 +13,23 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ +import debug_toolbar +from django.conf import settings from django.contrib import admin -from django.urls import path +from django.urls import path, include + import blog.views -from django.conf import settings urlpatterns = [ path('admin/', admin.site.urls), + path("ip/", blog.views.get_ip), path("", blog.views.index), path("post//", blog.views.post_detail, name="blog-post-detail") ] + +if settings.DEBUG: + urlpatterns += [ + path("__debug__/", include(debug_toolbar.urls)), + ] diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index be51965a7d8643bbb1c250dca7406d6713788a52..28d144440d168d00926b3b0cc142f42d1263e7e6 100644 GIT binary patch delta 14 VcmZo*Y+z(F=H=zGJUfxC3IGjc06 diff --git a/blog/__pycache__/apps.cpython-36.pyc b/blog/__pycache__/apps.cpython-36.pyc index 82183f38e599de9f998ac063e2232937a493915a..700b1ea9563627d32d1770b72aa0f7a4bad6ee2a 100644 GIT binary patch delta 15 WcmeBW?qy~(=H=zGJiC#toe=;WXamCl delta 15 WcmeBW?qy~(=H=yjzilI1J0k!fIRs(= diff --git a/blog/__pycache__/forms.cpython-36.pyc b/blog/__pycache__/forms.cpython-36.pyc index 621b7714d5aa66b6a5c6a918283f17236ffd1428..110a2ff5abcea451873ad385982d5d8583011cb2 100644 GIT binary patch delta 15 WcmbQkK8Kynn3tE!^6W;oY0Ll~lmq$z delta 15 WcmbQkK8Kynn3tF9{kDy4)0hDwWdxZ3 diff --git a/blog/__pycache__/models.cpython-36.pyc b/blog/__pycache__/models.cpython-36.pyc index b363832e50cc71cf3e0c316aa5958a70c94c9a5e..9aa6aac25c3d157161d8d7861fc132a776464b0f 100644 GIT binary patch delta 403 zcmX|6Jxjwt7|vb3OB-uTTU)XA1Cih;h;Bl$;Gh;;mnQ<4NyhH01-lb3!l?6J!~5fk;HY z#a5Au^F?qmQ4(yG{*(%xGSP;Dsi$f$@I2~ACQ9|dw+VG=L`R@BGPY+vp_lv}*DEGY z^G+NEwjW&B4k4@}2m=4Yhs{)-FzQ4BVm+aLg2u#H4*&(L#*meB#RPtlj{hi=NdfaG0$i$46 zfl_sFd^FnYjVuKQK7+YhS=7#`!xOpITF+Yg(2Y;~GwPC53gK$0VeEMhyJAiLDj%$M gp;QBeRUi$OP#$&>p#8u=8fIO-rQD+~e^a)<0snGf;Q#;t delta 403 zcmX|+J4*vW6oq$Y-(jBY7mqJ`4}vq=hdaAd!8UOLK_pJ0 zUBu$Jgd`--fL;Fc3ilPHo(L_Csof|DaG10J)1%Nq*vAQ`Z?IOfcx1R~5; zLp%gFJrx^`1wjy4wI9V^;$7qYFu_AidLH%>S)^1PZ)hL~3_vP;@0{!ZN!)d~;(K1T zNjuVtD9<1rNKSo;$1OmXvkx+P;Je`^lfu;Z>AUoNTjMzqGt@bl+CM(B_PUm>@QR~| zkkxFomSLU4Hm=fv@5LjG95*55EZ^i{`iY+o=S`Uub8D+{8U!wxkVZBx9Jt}ciZcG5 iqh_g;xb$0YgC=b&)uPES)8;aP21%1z$^##LDBC|;Droxv diff --git a/blog/__pycache__/views.cpython-36.pyc b/blog/__pycache__/views.cpython-36.pyc index e825166245f4a2a5875edade3e898897f4c26737..793ef53114ac87690d91d71db59a8f7dd97d7c68 100644 GIT binary patch delta 508 zcmYjOJxc>Y5Z&3kTw*>nVoah|5=0Ng6c$>D8ce`Og=i(h5wokwamj_fO?M)AR*Hoz z*!T<7(%RO>e{iio!N$_r*ks_not>|J!+xfpvz7H+E?p`8Tzn)5`6gp#qQ8p>?j9>Q zxg49kC8q_JJSO(kmnX0S+#5@$b&4xI;FXf=ggMr@(o~ delta 15 WcmeC?=;mNE=H=yjzilHMD+>T0f&=LQ diff --git a/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc b/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc index fe4f23ca81f43b6bf97f3cf94da8069477cdd713..a53f61b1edfb6fe3e98c25d8b19282701bc0e4a7 100644 GIT binary patch delta 15 WcmaFM`j(Z=n3tE!^6W;o=S%=6-2~_W delta 15 WcmaFM`j(Z=n3tF9{kDy4&zS%#t_6nx diff --git a/blog/migrations/__pycache__/0004_alter_post_published_at.cpython-36.pyc b/blog/migrations/__pycache__/0004_alter_post_published_at.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88652849a6cdade1017331b8f7e20bb03765429b GIT binary patch literal 599 zcmYjOJ#W@95Vm6{%^UTVnCL%1%F?7C5+ET|qzV@3LZ>WN^4>MgTPF^7qQXqq{s9(d z{*qTFRu&{C&M8%E%TF$MzUS^aAFbEfw?DrxzH`QYvPVmjeL}}QBLD_mvz}MHkE)2X zcMKvBHw*;wt@tV`0rDfu<6m@_<&n?&uC?{lnZfy_H-Or0Lg;>_WSr1(B>}RE1FIrf zwY(B2w=obMCfgl|mz~@S*tr!HO(CT+nO}Xl=l8PFruBPeSstl+o{Tyy50A^2<#TmV z9=z~!G;Z>{Xm!`*JW1us|wXs)jtT$K$6|JFc-x@EWdx~6q~sCp#ebGdzk+Sx-G^rBdg*itK6G?v?NPo@U)||{9R#@` H^NIKe092v` literal 0 HcmV?d00001 diff --git a/blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc b/blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b19a8213ccbdd1bb0ff98ecb15cb00ffe8e6313 GIT binary patch literal 669 zcmYjP!EV$r5OthnHyd`P3L(LPGg2PmU%`147`T5Ugott z;~qO>z`_5{z(=q4zxkOD!AF*azv(PXxQ$y`>3oo?Gj`G{z{Zr$br@4JPH34^0%Vy7 zEaUK?@-iQTIs^)blX?mv&B>0#ba&t*;v-^bJI}Ed&t?!)>baf0KjgGQ(WuHkT`rd! zkv9Ws(JM2Eep@usTqB5lu+vhtEp~&AOO5$3l9yEaJl_sVbm~^*05*a`$PVyJ;*%&R zM09zJHW)FylGuQqsiMYm5E2qk$E4^Y;X0&UPY9COMq>O+2pbDQQML_|Js09;n>Q|! z`vUBdGIgayqv|V=LCn^=A2My%DRItJQJ; zRlAqrgqeo~kv|CnkJCKj`+f9ZB!Qhl?Lr?zG0GVwjL!R__SO@MW24vm#=LP#jnjYR F{{z&Ov}ynV literal 0 HcmV?d00001 diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index 21ad3bbd5c93475c6dca7e4362f514b83a1fbe1f..0b937468d8b2c09733c45e18ce82b4840f6699af 100644 GIT binary patch delta 14 VcmeBX>}F&$=H=zGJUfxC6#y6C1DF5+ delta 14 VcmeBX>}F&$=H=yjzilF0D*zi21UCQx diff --git a/blog/models.py b/blog/models.py index b89e16e8d9..285e0953a3 100644 --- a/blog/models.py +++ b/blog/models.py @@ -15,16 +15,16 @@ class Comment(models.Model): creator = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) content = models.TextField() content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) - object_id = models.PositiveIntegerField() + object_id = models.PositiveIntegerField(db_index = True) content_object = GenericForeignKey("content_type", "object_id") - created_at = models.DateTimeField(auto_now_add=True) + created_at = models.DateTimeField(auto_now_add=True,db_index = True) modified_at = models.DateTimeField(auto_now=True) class Post(models.Model): author = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) created_at = models.DateTimeField(auto_now_add=True) modified_at = models.DateTimeField(auto_now=True) - published_at = models.DateTimeField(blank=True, null=True) + published_at = models.DateTimeField(blank=True, null=True,db_index =True ) title = models.TextField(max_length=100) slug = models.SlugField() summary = models.TextField(max_length=500) diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index b97178a051c6a8b0385ec8fbfe8ed1e1b7cf8258..98b35156892710d7ed902285218e79032a99baf4 100644 GIT binary patch delta 14 VcmeBW>}6y#=H=zGJUfxC9RL^=1D*f? delta 14 VcmeBW>}6y#=H=yjzilF0I{+I;1U&!% diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index 26fe9f49f128851f8815652f9ba8b174970f2d4f..dbbcea66225b300d0db6fc77996fef51f88fa945 100644 GIT binary patch delta 21 dcmcb?cY}}3n3tE!^6W;oIyS~zlUvy?0{}@e2R8r! delta 21 ccmcb?cY}}3n3tC;^4LbUIyT0r$*pXc0Y~Hp&;S4c diff --git a/blog/views.py b/blog/views.py index a331d08e6e..34d1c6f714 100644 --- a/blog/views.py +++ b/blog/views.py @@ -15,7 +15,7 @@ @vary_on_cookie def index(request): - posts = Post.objects.filter(published_at__lte=timezone.now()) + posts = Post.objects.filter(published_at__lte=timezone.now()).select_related("author") logger.debug("Got %d posts", len(posts)) return render(request, "blog/index.html", {"posts": posts}) @@ -41,4 +41,9 @@ def post_detail(request,slug): else: comment_form = None - return render(request,"blog/post-detail.html",{'post':post,"comment_form": comment_form}) \ No newline at end of file + return render(request,"blog/post-detail.html",{'post':post,"comment_form": comment_form}) + + +def get_ip(request): + from django.http import HttpResponse + return HttpResponse(request.META['REMOTE_ADDR']) \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 index 9db6ccb039887951cdc5f78ccdd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4 zd^c$#a1Z%NnLq(`k-j`wN$(Ws$XFiy#-UmB*IRz%- zD1se%NU#Xa#8lJ*V?{8i%SAYiP&@fP0}aSRYG+}5-^leqG?E++1^fLei#g~|g;J4N zh|J8wQ<8oF8EySHxQV3^qS+nI>}Y!DNW-5ir40&~@i4YX8ztqrB=}ezb&yBM>m?t* xKo_q$;n9#k1;k!~HsL(2qmJyRM=RiCdBkhTl?t3OYTf>kO>>TEvnv=;zX78W%Ci6f From 0fbf4c04f4d44a72b1a823edc2e0775924ab2b23 Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Fri, 4 Oct 2024 02:11:29 +0000 Subject: [PATCH 12/15] Finish custom User model --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 4668 -> 4726 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1200 -> 1200 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes blango/settings.py | 4 +- blango_auth/__init__.py | 0 .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 135 bytes blango_auth/__pycache__/admin.cpython-36.pyc | Bin 0 -> 1078 bytes blango_auth/__pycache__/apps.cpython-36.pyc | Bin 0 -> 417 bytes blango_auth/__pycache__/models.cpython-36.pyc | Bin 0 -> 1805 bytes blango_auth/admin.py | 41 +++++++++++++++ blango_auth/apps.py | 6 +++ blango_auth/migrations/0001_initial.py | 44 ++++++++++++++++ .../migrations/0002_auto_20241004_0114.py | 29 +++++++++++ blango_auth/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-36.pyc | Bin 0 -> 2316 bytes .../0002_auto_20241004_0114.cpython-36.pyc | Bin 0 -> 806 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 146 bytes blango_auth/models.py | 48 ++++++++++++++++++ blango_auth/tests.py | 3 ++ blango_auth/views.py | 3 ++ blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 513 -> 551 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 1822 -> 2227 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1563 -> 1563 bytes blog/admin.py | 5 +- blog/migrations/0006_authorprofile.py | 24 +++++++++ .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes ...004_alter_post_published_at.cpython-36.pyc | Bin 599 -> 599 bytes .../0005_auto_20240924_1811.cpython-36.pyc | Bin 669 -> 669 bytes .../0006_authorprofile.cpython-36.pyc | Bin 0 -> 907 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes blog/models.py | 8 +++ .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1880 -> 1880 bytes data.json | 1 + db.sqlite3 | Bin 192512 -> 200704 bytes templates/blog/post-detail.html | 10 ++++ 42 files changed, 223 insertions(+), 3 deletions(-) create mode 100644 blango_auth/__init__.py create mode 100644 blango_auth/__pycache__/__init__.cpython-36.pyc create mode 100644 blango_auth/__pycache__/admin.cpython-36.pyc create mode 100644 blango_auth/__pycache__/apps.cpython-36.pyc create mode 100644 blango_auth/__pycache__/models.cpython-36.pyc create mode 100644 blango_auth/admin.py create mode 100644 blango_auth/apps.py create mode 100644 blango_auth/migrations/0001_initial.py create mode 100644 blango_auth/migrations/0002_auto_20241004_0114.py create mode 100644 blango_auth/migrations/__init__.py create mode 100644 blango_auth/migrations/__pycache__/0001_initial.cpython-36.pyc create mode 100644 blango_auth/migrations/__pycache__/0002_auto_20241004_0114.cpython-36.pyc create mode 100644 blango_auth/migrations/__pycache__/__init__.cpython-36.pyc create mode 100644 blango_auth/models.py create mode 100644 blango_auth/tests.py create mode 100644 blango_auth/views.py create mode 100644 blog/migrations/0006_authorprofile.py create mode 100644 blog/migrations/__pycache__/0006_authorprofile.cpython-36.pyc create mode 100644 data.json diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 7d90761b1b3c107eb20ca16808cb484d78ba6eed..642e1f5b7719924b0c49a94ad8e225cb98aed6b2 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=yT@cKNFy&3=@vYCyo=_+1QsXU=t@egd`ZDi-a}N83tQXBH2l82{*LS z6f`aFbB?T3C>;gn_j?Q`a-21NH`;_{XaaV?$8A8qQJRg zOyHjN3Y5eaN}Sokc8_;@e7`37^(IlKDPC!skz&kXmuB&R(nHvzIYtH#dGI`D4n=0a zo3c z{N^s#nrDx-<8!^SWcg4*JJXJ|rd~NH_m9`jr{P4je}UE9Q`?r>VftcTgcB}HWxS1L j^J6%h-Dg7%tzn#=tTfVA&~A~H={NtKwQU9la121APGS}NbNjmSV+(SfiuOQRTOD2^;8Fl$Om zV$RU5lr@I=fy@XjWCV?)NE2B6x6kf0-^*}iQDR4lCb5KNlu^M7s;Hrk23E}oP2mdG zu#Wy!T*GxUNI7iKG;SC%+{_7{G>cofjXSuDrm67so36s~d2CSu_pr^r`#FIfZwEAk zT|8jVE?OgOk8rOmd3UpTNOL^UJl6tO5szpQ`&7aKE#V+e%XrMeWfY%_@{?iB|4a@) zC=LJcOX#~IE6#;hAO6;&zF><#$!p4-Ql!8fNTM_tqY`-+z_Vr`G@ sF?@AC>v`2<<*2>t{Lrh_rz|MgvCY$yHM`^)10Hyu|6-hWswTJp0HIHtwEzGB diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index ffc566af9ee6009012a4f75dc9421841acbd10b5..2a62242b4c93a6190bd9d81d2ca099f1b0450236 100644 GIT binary patch delta 16 XcmdnMxq*}2n3tEU!Rzxz_LVFEC!z%N delta 16 YcmdnMxq*}2n3tF9;PX!#*;ldv04)*)&;S4c diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index 4116ea3aaa01707348f5535ded7992a2ed94faac..7af20efeb10080c4441f463e044f5b5ba6f6b9f5 100644 GIT binary patch delta 16 XcmeBV>11Iy=H=yT@cO)worwtmAv6Q> delta 16 XcmeBV>11Iy=H=zGJo|PdI};NCA~ysm diff --git a/blango/settings.py b/blango/settings.py index 8bfef5a977..0985361d68 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -27,7 +27,8 @@ class Dev(Configuration): https://docs.djangoproject.com/en/3.2/ref/settings/ """ - + AUTH_USER_MODEL = "blango_auth.User" + PASSWORD_HASHERS = [ "django.contrib.auth.hashers.Argon2PasswordHasher", "django.contrib.auth.hashers.PBKDF2PasswordHasher", @@ -106,6 +107,7 @@ class Dev(Configuration): # Application definition INSTALLED_APPS = [ + "blango_auth", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", diff --git a/blango_auth/__init__.py b/blango_auth/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/blango_auth/__pycache__/__init__.cpython-36.pyc b/blango_auth/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fadb238f4b6b5edfc5779092bc6b4b7577e06229 GIT binary patch literal 135 zcmXr!<>j*B{guW51dl-k3@`#24nSPY0whuxf*CX!{Z=v*frJsnFBAQY{M=Oi=#N<@{q@2XO^n554pIBOwp&uWgnU`4-AFo$Xd5gm)H$SB`C)EyQS}_na F008VFATIy_ literal 0 HcmV?d00001 diff --git a/blango_auth/__pycache__/admin.cpython-36.pyc b/blango_auth/__pycache__/admin.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f54397de04e550a09d017f7a5875d05f521e755f GIT binary patch literal 1078 zcmY*Y&2rN)5VrgmJ8{xdT4>8(IOdW};mRE9)lO) zm2~CAD{z5b$4S8&ufA`!E3H4RpZ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$)edBEF%UBV0Fyo>rT_o{ literal 0 HcmV?d00001 diff --git a/blango_auth/models.py b/blango_auth/models.py new file mode 100644 index 0000000000..0cc86e5f52 --- /dev/null +++ b/blango_auth/models.py @@ -0,0 +1,48 @@ +from django.db import models +from django.contrib.auth.models import AbstractUser, UserManager +from django.utils.translation import gettext_lazy as _ + + +# Create your models here. +class BlangoUserManager(UserManager): + def _create_user(self, email, password, **extra_fields): + if not email: + raise ValueError("Email must be set") + email = self.normalize_email(email) + user = self.model(email=email, **extra_fields) + user.set_password(password) + user.save(using=self._db) + return user + + def create_user(self, email, password=None, **extra_fields): + extra_fields.setdefault("is_staff", False) + extra_fields.setdefault("is_superuser", False) + return self._create_user(email, password, **extra_fields) + + def create_superuser(self, email, password, **extra_fields): + extra_fields.setdefault("is_staff", True) + extra_fields.setdefault("is_superuser", True) + + if extra_fields.get("is_staff") is not True: + raise ValueError("Superuser must have is_staff=True.") + if extra_fields.get("is_superuser") is not True: + raise ValueError("Superuser must have is_superuser=True.") + + return self._create_user(email, password, **extra_fields) + + + +class User(AbstractUser): + username = None + email = models.EmailField( + _("email address"), + unique=True, + ) + + objects = BlangoUserManager() + + USERNAME_FIELD = "email" + REQUIRED_FIELDS = [] + + def __str__(self): + return self.email \ No newline at end of file diff --git a/blango_auth/tests.py b/blango_auth/tests.py new file mode 100644 index 0000000000..7ce503c2dd --- /dev/null +++ b/blango_auth/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/blango_auth/views.py b/blango_auth/views.py new file mode 100644 index 0000000000..91ea44a218 --- /dev/null +++ b/blango_auth/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index 28d144440d168d00926b3b0cc142f42d1263e7e6..625bbaf99a7eadf76c1a901946646cbdd0df51e6 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=yT@cKNFy%GQ%4+Jj& delta 15 WcmZo*Y+z(J=H=zGJo|PcdnEuI+yrF+ diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 52894ccc47a9ec82af714030a49766e69e418854..0abc4240a84a54bf21a924706c0e4ab0dc3ef66a 100644 GIT binary patch delta 308 zcmZoPT9T1p6i}4Ul9rj1I&noO8y`?x5#MBUMgwtn zAQR-sVkRKL!B_<1`)P7du46QeEMfz4ZgKhMr=;dMf@}cG-eM`vEJ?k^QIwjVSzMA@ rR0J^%s1(BD2WjH4$<0qG%}KQb1_(nj50KztlwcBK;bG)s9Z7$XD2V+JI^0%SV?adFH>lTMiZhlH>PO2Tya}32?K!S%+gh_~nhmnsF E0I5PVDF6Tf diff --git a/blog/__pycache__/apps.cpython-36.pyc b/blog/__pycache__/apps.cpython-36.pyc index 700b1ea9563627d32d1770b72aa0f7a4bad6ee2a..ee324884bfdba33d5bd023543629355d0ab6b3c1 100644 GIT binary patch delta 16 XcmeBW?qy~-=H=yT@cO)wy^Rq7B9{bv delta 16 XcmeBW?qy~-=H=zGJo|PddmAGFBbo%U diff --git a/blog/__pycache__/forms.cpython-36.pyc b/blog/__pycache__/forms.cpython-36.pyc index 110a2ff5abcea451873ad385982d5d8583011cb2..7c6290ad3a65536fd65323110b215763563e06cd 100644 GIT binary patch delta 16 XcmbQkK8Ky%n3tEU!Rzxz_NmMOB{FQmCF}&~ diff --git a/blog/__pycache__/models.cpython-36.pyc b/blog/__pycache__/models.cpython-36.pyc index 9aa6aac25c3d157161d8d7861fc132a776464b0f..b7a3e1da4f70e331b65dce66a09c2f1aa92559ea 100644 GIT binary patch delta 562 zcmY+AO)mpM7{}*jyIOXu8iF87gY3ae;tO~QPKt0Ehe_MnYMW){neKr|95_hCLG~zo z2XS@wA@(FBK7^BJmI%-0|J(o0JUjEx^N@e)D=)fk_sigC(huN zw;MzU>n%S}iKWqsE*%{nR^bH3;%Kv z3=!RmE9;Vo9+kmRcH%Baon{Ez5H?zYFS?GujmMxLPk<>zogz$`H%G0awAnr*ZPKQ9 zL{W6?j@)xRlT}WgQdn#I^-ie~Lh0P&NlwaoP}N#W=*9mME7CrA6ngLjoL{)c732IP~Y?MZ1_Q7QO(TXK-u) delta 161 zcmdliIFC=+n3tDp2gB#IGpq~@j~S2v3y|#q#KmP3l}p)Dc!C);c{gs@!^C)Nb1t(h z6So3Tu1FC?C{5nWDz2aoWZvQo&M8fI%S_Elxy4cpWJa+Um*(as7F8C>P5#2_%cwlr oiA|YZ8K~4xlXvn9_HLkvER*=;2^{=Fd_YkiMkr(!ViV#70LvyL+W-In diff --git a/blog/__pycache__/views.cpython-36.pyc b/blog/__pycache__/views.cpython-36.pyc index 793ef53114ac87690d91d71db59a8f7dd97d7c68..0d0e04316d4a5183ef46f344ec86977700a4dc1f 100644 GIT binary patch delta 15 WcmbQuGnsDB76V8C delta 15 WcmbQuGnsD7=>oU_ diff --git a/blog/admin.py b/blog/admin.py index 7449699dda..ffcebcb787 100644 --- a/blog/admin.py +++ b/blog/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from blog.models import Tag, Post, Comment +from blog.models import Tag, Post, Comment, AuthorProfile class PostAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ["title"]} @@ -7,4 +7,5 @@ class PostAdmin(admin.ModelAdmin): # Register your models here. admin.site.register(Tag) admin.site.register(Post, PostAdmin) -admin.site.register(Comment) \ No newline at end of file +admin.site.register(Comment) +admin.site.register(AuthorProfile) \ No newline at end of file diff --git a/blog/migrations/0006_authorprofile.py b/blog/migrations/0006_authorprofile.py new file mode 100644 index 0000000000..97c6cd0f4c --- /dev/null +++ b/blog/migrations/0006_authorprofile.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.6 on 2024-09-30 03:15 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('blog', '0005_auto_20240924_1811'), + ] + + operations = [ + migrations.CreateModel( + name='AuthorProfile', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('bio', models.TextField()), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/blog/migrations/__pycache__/0001_initial.cpython-36.pyc b/blog/migrations/__pycache__/0001_initial.cpython-36.pyc index 1b00ded4abcb4e59365c1aeec87272c890c96ea2..41a1160b081663fc61d179add8549fdb9a1b0099 100644 GIT binary patch delta 16 XcmX@ld7hKqn3tEU!Rzxz_7f}sD}n`3 delta 16 XcmX@ld7hKqn3tE!^6cA<>?c?NEQJMz diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc index 965748ea7d342026fee93d7723b83515ec26f50a..8bd93d9d4dba341cb6354e1ff938210d9d69c31a 100644 GIT binary patch delta 16 XcmeC?=;mNI=H=yT@cO)worMJeA?5@E delta 16 XcmeC?=;mNI=H=zGJo|PdI|~Z{BIyJ; diff --git a/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc b/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc index a53f61b1edfb6fe3e98c25d8b19282701bc0e4a7..5edab09f0b74f8bdac41a4b3bc6ea24b7ed3cd9f 100644 GIT binary patch delta 16 XcmaFM`j(a5n3tEU!Rzxz_Ge50F3<&_ delta 16 XcmaFM`j(a5n3tE!^6cA0 delta 16 Xcmcc4a-D_Un3tDp*7r{v*#npWFS7-r diff --git a/blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc b/blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc index 2b19a8213ccbdd1bb0ff98ecb15cb00ffe8e6313..8ee75feb27181c726488979ccb10b8d0e2d0f420 100644 GIT binary patch delta 15 WcmbQsI+vBrn3tEU!D}PibS3~Dm;<~3 delta 15 WcmbQsI+vBrn3tF9IKxJ^=}Z6}&;z*u diff --git a/blog/migrations/__pycache__/0006_authorprofile.cpython-36.pyc b/blog/migrations/__pycache__/0006_authorprofile.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..52badc50666cd6ed6bd56b4fea5404412fb842ff GIT binary patch literal 907 zcmYjP&2G~`5VqHjV>?dMqDmDq=*Xm;_zC+st4lcT$&i@UvK# z+1F-7n1j0Bm4?Vgxf1(#A}c#(0$9;IIwVWu8ZDzW7ntXG#|S%x#T zGhXt7@nXJ|M41MYv*`zVc6#uI9-ZtTd;;&@BjFYF_L>@xRQseF7w~qI7>N;wDkX5H z{CnNP{z<{70!4eZSQ-|w0K#TqHx=R}KzDC)x;NQB09Ta!b~=7(@+n4c#Le#LT;zN- z7c3E@OCc|+GMw|#EK|Yo5b@|?u146pm#THxrdvvfHoM_m6j4irbE{#qhO@TV$M?!%JHf-dO5_ujvij3Q@-2FXI}F&)=H=yT@cKNFy#)XrP6SW@ delta 15 WcmeBX>}F&)=H=zGJo|PcdkX*_8w7>` diff --git a/blog/models.py b/blog/models.py index 285e0953a3..bdfb5acadc 100644 --- a/blog/models.py +++ b/blog/models.py @@ -36,3 +36,11 @@ def __str__(self): return self.title +class AuthorProfile(models.Model): + user = models.OneToOneField( + settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="profile" + ) + bio = models.TextField() + + def __str__(self): + return f"{self.__class__.__name__} object for {self.user}" \ No newline at end of file diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 98b35156892710d7ed902285218e79032a99baf4..09cb2032ffe599253f8b402e09875bec2fc6214d 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=yT@cKNFy$t{zhy+#u delta 15 WcmeBW>}6y(=H=zGJo|Pcdm8{ARRoLx diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index dbbcea66225b300d0db6fc77996fef51f88fa945..211956e1803fa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)Mcy==V@BWW-LAE u25ramnmvGYyUAATY%mnCh8Gio*~uzmqv-kn_(VxWCb%8Of&OV@o&N)eHstRB diff --git a/templates/blog/post-detail.html b/templates/blog/post-detail.html index a87e0deb0b..50bd49b676 100644 --- a/templates/blog/post-detail.html +++ b/templates/blog/post-detail.html @@ -9,11 +9,21 @@

{{ post.title }}

{% include "blog/post-byline.html" %} {% endrow %} + +{% if post.author.profile %} + {% row %} + {% col %} +

About the author

+

{{ post.author.profile.bio }}

+ {% endcol %} + {% endrow %} +{% endif %} {% row %}
{{ post.content|safe }}
{% endrow %} + {% include "blog/post-comments.html" %} {% row %} {% col %} From 8574465959a4a1baf6c3b0533daaaedd093a92b9 Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Sat, 5 Oct 2024 01:24:40 +0000 Subject: [PATCH 13/15] (Fixed)Finish custom User model --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 4726 -> 4726 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1200 -> 1200 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 135 -> 135 bytes blango_auth/__pycache__/admin.cpython-36.pyc | Bin 1078 -> 1078 bytes blango_auth/__pycache__/apps.cpython-36.pyc | Bin 417 -> 417 bytes blango_auth/__pycache__/models.cpython-36.pyc | Bin 1805 -> 1805 bytes blango_auth/admin.py | 8 +++++++- blango_auth/migrations/0001_initial.py | 2 +- ...004_0114.py => 0002_auto_20241005_0122.py} | 2 +- .../__pycache__/0001_initial.cpython-36.pyc | Bin 2316 -> 2316 bytes ...=> 0002_auto_20241005_0122.cpython-36.pyc} | Bin 806 -> 806 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 146 -> 146 bytes blango_auth/models.py | 3 --- blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 551 -> 551 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 2227 -> 2227 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1563 -> 1563 bytes blog/migrations/0006_authorprofile.py | 2 +- .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes ...004_alter_post_published_at.cpython-36.pyc | Bin 599 -> 599 bytes .../0005_auto_20240924_1811.cpython-36.pyc | Bin 669 -> 669 bytes .../0006_authorprofile.cpython-36.pyc | Bin 907 -> 907 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1880 -> 1880 bytes data.json | 2 +- db.sqlite3 | Bin 200704 -> 204800 bytes 33 files changed, 11 insertions(+), 8 deletions(-) rename blango_auth/migrations/{0002_auto_20241004_0114.py => 0002_auto_20241005_0122.py} (93%) rename blango_auth/migrations/__pycache__/{0002_auto_20241004_0114.cpython-36.pyc => 0002_auto_20241005_0122.cpython-36.pyc} (84%) diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 642e1f5b7719924b0c49a94ad8e225cb98aed6b2..49606ff1cf46cbb211dfccd9a0243cccd84e6b8c 100644 GIT binary patch delta 16 XcmZo-Y+~dv=H=yD+RBhVk)sL#9=Zey delta 16 XcmZo-Y+~dv=H=yT@cNuKk)sL#ArJ(d diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 702c89678bbb4b7289fe9e6240adf813af6dedaf..2087313128e324eefbdf8682f7f39cc43720241c 100644 GIT binary patch delta 17 YcmeyS@=b-qn3tC;tCt~tBS)SP05muSD*ylh delta 17 YcmeyS@=b-qn3tC;kndO8Mvgoo05#49i~s-t diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index 2a62242b4c93a6190bd9d81d2ca099f1b0450236..3bf8a6a57fd436a77bf72d8b9fc8c3208927be18 100644 GIT binary patch delta 17 YcmdnMxq*|zn3tDpX)8neMvfIM04h`j$N&HU delta 17 YcmdnMxq*|zn3tEU!RvF{MvfIM04+QPS^xk5 diff --git a/blango/__pycache__/wsgi.cpython-36.pyc b/blango/__pycache__/wsgi.cpython-36.pyc index 7af20efeb10080c4441f463e044f5b5ba6f6b9f5..e838d56abbc4661ab8f498c2ff4030ba1000590c 100644 GIT binary patch delta 17 YcmeBV>15$B=H=yD+RBi=k%N&503(hA#{d8T delta 17 YcmeBV>15$B=H=yT@cNv#k%N&5048<>SpWb4 diff --git a/blango_auth/__pycache__/__init__.cpython-36.pyc b/blango_auth/__pycache__/__init__.cpython-36.pyc index fadb238f4b6b5edfc5779092bc6b4b7577e06229..7ae43cb310f32a52d2a82e40b88d3134ab712e07 100644 GIT binary patch delta 16 XcmZo?Y-i*!=H=xI>1Ifu$Wadf9YO=n delta 16 XcmZo?Y-i*!=H=zG;r*31k)s{}9)tuj diff --git a/blango_auth/__pycache__/admin.cpython-36.pyc b/blango_auth/__pycache__/admin.cpython-36.pyc index f54397de04e550a09d017f7a5875d05f521e755f..5cb200fcfa4c7f67a82105350edfcf3966dc725c 100644 GIT binary patch delta 18 ZcmdnSv5kY%n3tF9#1w|~=8c@XEC4aU1r7iJ delta 18 ZcmdnSv5kY%n3tE!*Xe&+%|=dL7637=1vmfz diff --git a/blango_auth/__pycache__/apps.cpython-36.pyc b/blango_auth/__pycache__/apps.cpython-36.pyc index 5b185dc6bd7bae9d3782472a93a4147fd27bdeff..81530418c10a33fa7dac983a5bbcbea4013d6b7e 100644 GIT binary patch delta 17 YcmZ3;ypWm0n3tC;q?;jqBgafe03|^LK>z>% delta 17 YcmZ3;ypWm0n3tE!hWA(6Mvj?`04C-HqyPW_ diff --git a/blango_auth/__pycache__/models.cpython-36.pyc b/blango_auth/__pycache__/models.cpython-36.pyc index 5019855b13fbbf71e3a51e5134af786acd7e67b3..4e20cf48e445fdbbc9503544d42364b5db1d4fe8 100644 GIT binary patch delta 60 zcmV-C0K@-{4vh{9GYt(2XOjSD{ROcKGy(wzlRpC50S~hp1401-6q8*9ivb0b=>*mR SER(>*eDz=H=yTu=$_Hz_yXggo%-3vOUu+M#0Te%ubAqVv}Q8x*6Fgzht?_s6Y7t Q>r6)F$x&<@m{|m50MJGcn*aa+ diff --git a/blango_auth/admin.py b/blango_auth/admin.py index 68a45f2caf..c579f2d50f 100644 --- a/blango_auth/admin.py +++ b/blango_auth/admin.py @@ -38,4 +38,10 @@ class BlangoUserAdmin(UserAdmin): -admin.site.register(User, BlangoUserAdmin) \ No newline at end of file +admin.site.register(User, BlangoUserAdmin) + + + + + + diff --git a/blango_auth/migrations/0001_initial.py b/blango_auth/migrations/0001_initial.py index c21fe57733..10a59d6a53 100644 --- a/blango_auth/migrations/0001_initial.py +++ b/blango_auth/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.6 on 2024-09-30 03:03 +# Generated by Django 3.2.6 on 2024-10-05 00:51 import django.contrib.auth.models import django.contrib.auth.validators diff --git a/blango_auth/migrations/0002_auto_20241004_0114.py b/blango_auth/migrations/0002_auto_20241005_0122.py similarity index 93% rename from blango_auth/migrations/0002_auto_20241004_0114.py rename to blango_auth/migrations/0002_auto_20241005_0122.py index 3519d16c85..5622812d14 100644 --- a/blango_auth/migrations/0002_auto_20241004_0114.py +++ b/blango_auth/migrations/0002_auto_20241005_0122.py @@ -1,4 +1,4 @@ -# Generated by Django 3.2.6 on 2024-10-04 01:14 +# Generated by Django 3.2.6 on 2024-10-05 01:22 import blango_auth.models from django.db import migrations, models diff --git a/blango_auth/migrations/__pycache__/0001_initial.cpython-36.pyc b/blango_auth/migrations/__pycache__/0001_initial.cpython-36.pyc index e82d90099238f911774d8738f9fe1781bd394a07..ee76e9c58377ecdcce2b1464808dfd74af2c7f16 100644 GIT binary patch delta 17 YcmeAX>Jj2F=H=yD+RKo>k%NU3043K0`v3p{ delta 17 YcmeAX>Jj2F=H=yjA@VD2BL@p704jF`z5oCK diff --git a/blango_auth/migrations/__pycache__/0002_auto_20241004_0114.cpython-36.pyc b/blango_auth/migrations/__pycache__/0002_auto_20241005_0122.cpython-36.pyc similarity index 84% rename from blango_auth/migrations/__pycache__/0002_auto_20241004_0114.cpython-36.pyc rename to blango_auth/migrations/__pycache__/0002_auto_20241005_0122.cpython-36.pyc index 1a2733e7c51527b93e5d410bf304b0044e0db7fc..2d3eecbbd96c65f8f43bfccfeb3252e6fee40736 100644 GIT binary patch delta 28 kcmZ3+wv3I#n3tF9#1w|~jT}8pY^L!BhDJt{XEF5v0BxxU+yDRo delta 28 jcmZ3+wv3I#n3tC;!SR3EMvfjPHj{V*Lqn6vvzU4SaP$Zt diff --git a/blango_auth/migrations/__pycache__/__init__.cpython-36.pyc b/blango_auth/migrations/__pycache__/__init__.cpython-36.pyc index 18b23fbda357daf4915df3657abd54064b3d51fa..c99af90076e283d091da1ccf9a49490e81d908f6 100644 GIT binary patch delta 16 XcmbQlIEj(Nn3tC;q?;jqB1abh9+v~} delta 16 XcmbQlIEj(Nn3tE!hWA(6M2;>1AK3&_ diff --git a/blango_auth/models.py b/blango_auth/models.py index 0cc86e5f52..6000c587c0 100644 --- a/blango_auth/models.py +++ b/blango_auth/models.py @@ -1,8 +1,6 @@ from django.db import models from django.contrib.auth.models import AbstractUser, UserManager from django.utils.translation import gettext_lazy as _ - - # Create your models here. class BlangoUserManager(UserManager): def _create_user(self, email, password, **extra_fields): @@ -31,7 +29,6 @@ def create_superuser(self, email, password, **extra_fields): return self._create_user(email, password, **extra_fields) - class User(AbstractUser): username = None email = models.EmailField( diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index 625bbaf99a7eadf76c1a901946646cbdd0df51e6..cc55c380a61bd116da636d48a7ab3909daedbe61 100644 GIT binary patch delta 16 XcmZo*Y+&Rt=H=yD+RBhVk)r|t9()7@ delta 16 XcmZo*Y+&Rt=H=yT@cNuKk)r|tAkqYu diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 0abc4240a84a54bf21a924706c0e4ab0dc3ef66a..0745f9e9eea15c3cd0e43eab6b5536d6f2e31597 100644 GIT binary patch delta 17 YcmZ3^vYds(n3tDpX)8neMhjU1~v056LLkpKVy diff --git a/blog/__pycache__/views.cpython-36.pyc b/blog/__pycache__/views.cpython-36.pyc index 0d0e04316d4a5183ef46f344ec86977700a4dc1f..59d124e1f5a257fd54ad3fa4522ce4a11796fd5e 100644 GIT binary patch delta 17 YcmbQuGn(^b delta 17 YcmX@ld7hKQn3tEU!RvF{Mvmhw05Mtxw*UYD diff --git a/blog/migrations/__pycache__/0002_comment.cpython-36.pyc b/blog/migrations/__pycache__/0002_comment.cpython-36.pyc index 8bd93d9d4dba341cb6354e1ff938210d9d69c31a..0e6c66fd1db5241142319491c803676fe21671b6 100644 GIT binary patch delta 17 YcmeC?=;q)s=H=yD+RBi=k%O5903=KU*8l(j delta 17 YcmeC?=;q)s=H=yT@cNv#k%O5904FpAX#fBK diff --git a/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc b/blog/migrations/__pycache__/0003_auto_20240907_1018.cpython-36.pyc index 5edab09f0b74f8bdac41a4b3bc6ea24b7ed3cd9f..cc2584136264fa24f114ab84ae79753e17234ab5 100644 GIT binary patch delta 17 YcmaFM`j(Z$n3tDpX)8neMvkXU05S9hbpQYW delta 17 YcmaFM`j(Z$n3tEU!RvF{MvkXU05seN2LJ#7 diff --git a/blog/migrations/__pycache__/0004_alter_post_published_at.cpython-36.pyc b/blog/migrations/__pycache__/0004_alter_post_published_at.cpython-36.pyc index 71f1a406979872626d627a8b7eb6c16a0c5c3069..b77bfd55ce29a675ebf94cf454c6889c61143a0e 100644 GIT binary patch delta 17 Ycmcc4a-D_4n3tDpX)8neMh<@_04?eSu>b%7 delta 17 Ycmcc4a-D_4n3tEU!RvF{Mh<@_05H-8LjV8( diff --git a/blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc b/blog/migrations/__pycache__/0005_auto_20240924_1811.cpython-36.pyc index 8ee75feb27181c726488979ccb10b8d0e2d0f420..5d461150b8222ab352efef0dfe629fed9fdf4f48 100644 GIT binary patch delta 17 YcmbQsI+vBhn3tDpX)8neMvkdW04G!gg#Z8m delta 17 YcmbQsI+vBhn3tEU!RvF{MvkdW04h8M7XSbN diff --git a/blog/migrations/__pycache__/0006_authorprofile.cpython-36.pyc b/blog/migrations/__pycache__/0006_authorprofile.cpython-36.pyc index 52badc50666cd6ed6bd56b4fea5404412fb842ff..9ad06e5dcdc58e6fd297eb38da79d956e885df38 100644 GIT binary patch delta 17 YcmeBX?`G#P=H=yL>1IgZ$kEIU03c5Txc~qF delta 17 YcmeBX?`G#P=H=x&A^t0EBS$kc04W*;0ssI2 diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index d6ff0eb352260104f341354f2556dd0c6aee4c1b..aea4237b9c23d6430a7501c09a77e5377def8447 100644 GIT binary patch delta 16 XcmeBX>}KRJ=H=yD+RBhVk)s&^AJGIQ delta 16 XcmeBX>}KRJ=H=yT@cNuKk)s&^A}0j5 diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 09cb2032ffe599253f8b402e09875bec2fc6214d..8303b6bd26909335a39f01151d7e9e8d051e29e6 100644 GIT binary patch delta 16 XcmeBW>}BLI=H=yD+RBhVk)ss=AP)p9 delta 16 XcmeBW>}BLI=H=yT@cNuKk)ss=B4q@< diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index 211956e1803fa5547fc68c1032c08dd1fa976332..2802ec398a187fd546f3cbf0c26e390b48fe91af 100644 GIT binary patch delta 17 Ycmcb?cY}|^n3tDpX)8neMvee>053fR%>V!Z delta 17 Ycmcb?cY}|^n3tEU!RvF{Mvee>05T;7UjP6A diff --git a/data.json b/data.json index 6814a1be2c..30229f6d52 100644 --- a/data.json +++ b/data.json @@ -1 +1 @@ -[{"model": "blog.comment", "pk": 2, "fields": {"creator": 1, "content": "I like myself!", "content_type": 4, "object_id": 1, "created_at": "2024-09-07T13:35:22.696Z", "modified_at": "2024-09-07T13:35:22.713Z"}}, {"model": "blog.comment", "pk": 3, "fields": {"creator": 3, "content": "wonderfull!", "content_type": 8, "object_id": 1, "created_at": "2024-09-08T19:09:55.378Z", "modified_at": "2024-09-08T19:09:55.378Z"}}, {"model": "blog.comment", "pk": 4, "fields": {"creator": 3, "content": "great", "content_type": 8, "object_id": 2, "created_at": "2024-09-08T19:10:09.602Z", "modified_at": "2024-09-08T19:10:09.602Z"}}, {"model": "blog.comment", "pk": 5, "fields": {"creator": 3, "content": "Continue", "content_type": 8, "object_id": 1, "created_at": "2024-09-09T10:31:59.631Z", "modified_at": "2024-09-09T10:31:59.631Z"}}, {"model": "blog.tag", "pk": 1, "fields": {"value": "django"}}, {"model": "blog.post", "pk": 1, "fields": {"author": 2, "created_at": "2024-09-05T08:09:59.307Z", "modified_at": "2024-09-07T13:15:47.999Z", "published_at": "2024-09-05T08:08:42Z", "title": "An Example Post", "slug": "an-example-post", "summary": "A short example post", "content": "example", "tags": [1]}}, {"model": "blog.post", "pk": 2, "fields": {"author": 1, "created_at": "2024-09-07T11:41:00.421Z", "modified_at": "2024-09-07T11:41:00.421Z", "published_at": "2024-09-07T11:31:34Z", "title": "No Pain No Gain", "slug": "no-pain-no-gain", "summary": "just make your best and all will be fine", "content": "Tell me why\r\nShould I let you go, go, go, go\r\nYou know I love you so, so, so, so\r\nThat's why I am here tonight\r\nSo put your hands up\r\nWhy shouldn't I flow, flow, flow, flow?\r\nAnd pump it up on stereo, oh, oh, oh, oh\r\nIt's time to stomp on five\r\n\r\nLadies and gentlemen, the 89ers are back, come on, let's go!\r\n\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n\r\nThis song's for you and that's no lie\r\nYou can't imagine, how hard I really try\r\nTo satisfy you everyday\r\nAnd all that you do is coming at me\r\nYou doing it like a killer-bee\r\nHey, hey, it's alright\r\nWe have to stop our feeling-fight\r\nOh, oh, you take my hand\r\n89ers is a punk tend band\r\n\r\nPlease tell me why should I let you go, go, go, go\r\nBecause I love you so, so, so, so\r\nThat's why I'm here tonight\r\nSo put your hands up\r\nWhy shouldn't I let it flow flow flow?\r\nAnd pump it up the stereo, oh, oh, oh, oh\r\nIt's time to stop the fight!\r\n\r\nCome with me, let's go for a ride\r\nFollow me to the brighter side\r\nPretty girl, just look around\r\nThat everybody is jumping around to the 89ers sound\r\nHey, hey, what's that noise?\r\nRushing into ears of the girls and the boys\r\nOh, oh, enjoy the show\r\nThat the 89ers never punchline flow\r\n\r\nPlease tell me why should I let you go, go, go, go\r\nBecause I love you so, so, so, so\r\nThat's why I'm here tonight\r\nSo put your hands up\r\nWhy shouldn't I let it flow flow flow?\r\nAnd pump it up the stereo, oh, oh, oh\r\nIt's time to stop the fight!\r\n\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n(Whoo-oo)\r\n\r\nPlease tell me why should I let you go, go, go, go\r\nBecause I love you so, so, so, so\r\nThat's why I'm here tonight\r\nSo put your hands up\r\nWhy shouldn't I let it flow flow flow?\r\nAnd pump it up the stereo, oh, oh, oh\r\nIt's time to stop the fight!\r\n\r\n\r\nAdd to favorites\r\n\r\nAdd to playlist\r\n\r\nFont size\r\nTab\r\nPrint\r\nCorrect\r\n\r\nAuto-scroll", "tags": [1]}}, {"model": "blango_auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$260000$o7DTh9eqqv0EimHkzb9BOM$0MliSxvL/HwG67CapZpOYf76V+tcWO5Us5YhznhOFnU=", "last_login": "2024-09-07T11:31:15Z", "is_superuser": true, "username": "Zoldycks", "first_name": "Hunter", "last_name": "Silva", "email": "ahmediizekry@gmail.com", "is_staff": true, "is_active": true, "date_joined": "2024-09-05T08:06:01Z", "groups": [], "user_permissions": []}}, {"model": "blango_auth.user", "pk": 2, "fields": {"password": "pbkdf2_sha256$260000$SXwqKRlvz3IboAkJygYyld$aIRu0FUj6qNJ59iAUNiP6nmWrU9L8nrOJGZGoqA3jyM=", "last_login": null, "is_superuser": false, "username": "codio", "first_name": "Ahmed", "last_name": "ibrahim", "email": "ahmedzekry@gmail.com", "is_staff": false, "is_active": true, "date_joined": "2024-09-07T13:14:21Z", "groups": [], "user_permissions": []}}, {"model": "blango_auth.user", "pk": 3, "fields": {"password": "pbkdf2_sha256$260000$ETPMU7VEJhLYaYU5AbjP9Y$2BMh0e9+fssUx1uWvF+Y74b5bZn/jkehc7zBLJJQk5w=", "last_login": "2024-09-08T19:09:22.333Z", "is_superuser": true, "username": "ahmed", "first_name": "", "last_name": "", "email": "example@gmail.com", "is_staff": true, "is_active": true, "date_joined": "2024-09-08T19:08:33.694Z", "groups": [], "user_permissions": []}}, {"model": "blango_auth.user", "pk": 4, "fields": {"password": "argon2$argon2id$v=19$m=102400,t=2,p=8$cTFXSzlYY014STRZQ01iY0RqSWxpNg$TtwXCIdBCNiwXF1UQ22yvA", "last_login": "2024-09-24T16:33:07.475Z", "is_superuser": true, "username": "Zoldyck", "first_name": "", "last_name": "", "email": "example@gmail.com", "is_staff": true, "is_active": true, "date_joined": "2024-09-17T15:42:15.364Z", "groups": [], "user_permissions": []}}] \ No newline at end of file +[{"model": "auth.user", "pk": 1, "fields": {"password": "argon2$argon2id$v=19$m=102400,t=2,p=8$SzUyWk1nV0hNblVFSm9Sc29wcmhKUg$yqkcmH4ZOFp4xCOLrG4KBA", "last_login": null, "is_superuser": true, "username": "codio", "first_name": "", "last_name": "", "email": "example@gmail.com", "is_staff": true, "is_active": true, "date_joined": "2024-10-05T00:23:29.550Z", "groups": [], "user_permissions": []}}] \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 index 09d95131aa1ae1b195fca0778ad1e26e329c46d1..f699856345cc8143e93e4ff6c0392b166f026744 100644 GIT binary patch delta 3671 zcmai1e@q+a8NTn%*gk^&K}zBRAu$j_y2R#wpU+9v7;p#>ApA1KZRH*I8EpK6-~&Ut zl(>XVoz^V$I^DFY+V)SkKdQE@72ec!?WU^jUu(K%lTuAvx=l;frE9dc+q$Icz6098 zk!VJIaQEEzyzlpZ&-;Amvp*<1`)b*Rnu>@U%U}H-bR0&Pl{F4D zR+9^wt(+>kLB38dEEn3zV4%7LYd91bP05+DY($<`$0>?pjDNBbhGICHqWB0!GmLTJ zp(zi=yD8ewFn)&j(iFq^Shh<0ylS^=9i#j_<7Y)L$4Vk4@ONu(R=IbWFqWn{j?tLv zCNsh?w2v3HO!YxCVx+**+H=)Sl_oZdlO#_2pt^SR6u~R;49`p2u9{tD#D|t8a$0wd zU`7N{^ie+TyEWd;VFa&$svv3a*6cP<;aQqOt8wgVFe4l#p!#URUA!4#L{SuI?c2LN zTM&xnSwVYy7iC6J1z3^NcGhxcgc2x8l(a}KyBXoVlEkwdt^KIhw*_HPacJ%1TCW*F z8^EGUi@Te*AQbE41?{2TrmT6d$k7}vX)o_KWzBm9krO#q!}pkKfDnomI7&Od$Fx1X zmq+ngPCK)84vV&$p|m&l?BzG9fcLTt%hR+2wqo0yp9A<3yb7c68R&se!LP#*e8>4Y zbUFXBTzJiCfiA3ODd5uTnycow6CSWZ{E_LLGDTF{(A`*attDdVL?)8Tj@jWXb{FcQ zjh}5!qLv&*U__P2?y?XEfYCvbNo6XX$mJ5*%zmh2&Ra8J8PT}*d^DR*D;aeM!mJqP zC?)owG!V~ZHmBm+GtG@VtFi5nxaZbgBSa2=;c9a&RZ2L$80>TY!s%TuxSg=zAj+^p zD@HmT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YmdRC}|er(pi88wX>kIBclc9T7Al?tI7h+^H>xCcoNn_8yw#KBV5GZo?$^7WD-* zw|Rpc?nhs1a~v8+{B3Xgs28aWb-L}%t@8KVO2ZA!zAg-l#R7v67~RZk&BWd^hvvF_ zBj^3izIJ2>OT&5P-eu&_^tWdOkdhL;doaXDiDuu!o;wB0OlkIV-Y~lBjom#f-fhf# zAKsfHFXGLas;gGnTuX_f%l+I>Sfr9xd;Nb`hCHFV{EU#{Z?Qq}cj~ ztSX!AT1H?CIXRL|ORF1#oh=wSMNg)~+StbY%FxhcL62RY)|LjjOzdKz5X&Z!7*|?Y=buN!>gj{jcDl9M;#6?+6EXEm^ zUswbJ7v{B8EN}Bu88I|pSSpBX()xU2RT-XCLv!N5h&w$}aLy0uD=Wjp_QK%gz+yZx zkR2OZ8ci3S(8@@0W;(=dj$AsgFI^s)w`b$iQPx?PR@bAO>oYUXcyerB$WI&dkg_C&U=573KivF}Hy+r(q z>N=!bd!KvDNBx3&3t0S56x)RReMhl$8b6NteKIzRW>^?xQF(jwiwZL!QG4%#7sxx* RN1%3#YC*3txc3f4{11r6Aus>{ From 8977cd27df2d531a7eed11adb0fe731f2d605ee2 Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Thu, 24 Oct 2024 10:07:45 +0000 Subject: [PATCH 14/15] Finish django registration --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 4726 -> 4831 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1200 -> 1655 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes blango/settings.py | 3 ++ blango/urls.py | 12 ++++++- .../__pycache__/__init__.cpython-36.pyc | Bin 135 -> 135 bytes blango_auth/__pycache__/admin.cpython-36.pyc | Bin 1078 -> 1078 bytes blango_auth/__pycache__/apps.cpython-36.pyc | Bin 417 -> 417 bytes blango_auth/__pycache__/forms.cpython-36.pyc | Bin 0 -> 974 bytes blango_auth/__pycache__/models.cpython-36.pyc | Bin 1805 -> 1805 bytes blango_auth/__pycache__/views.cpython-36.pyc | Bin 0 -> 404 bytes blango_auth/forms.py | 15 +++++++++ .../__pycache__/0001_initial.cpython-36.pyc | Bin 2316 -> 2316 bytes .../0002_auto_20241005_0122.cpython-36.pyc | Bin 806 -> 806 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 146 -> 146 bytes .../templates/blango_auth/profile.html | 11 +++++++ .../activation_complete.html | 12 +++++++ .../activation_email_body.txt | 10 ++++++ .../activation_email_subject.txt | 1 + .../activation_failed.html | 12 +++++++ .../registration_closed.html | 10 ++++++ .../registration_complete.html | 11 +++++++ .../registration_form.html | 11 +++++++ blango_auth/templates/registration/login.html | 30 ++++++++++++++++++ blango_auth/views.py | 7 ++++ blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 551 -> 551 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 2227 -> 2227 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1563 -> 1563 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes ...004_alter_post_published_at.cpython-36.pyc | Bin 599 -> 599 bytes .../0005_auto_20240924_1811.cpython-36.pyc | Bin 669 -> 669 bytes .../0006_authorprofile.cpython-36.pyc | Bin 907 -> 907 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1880 -> 1880 bytes db.sqlite3 | Bin 204800 -> 204800 bytes templates/base.html | 16 +++++++++- 43 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 blango_auth/__pycache__/forms.cpython-36.pyc create mode 100644 blango_auth/__pycache__/views.cpython-36.pyc create mode 100644 blango_auth/forms.py create mode 100644 blango_auth/templates/blango_auth/profile.html create mode 100644 blango_auth/templates/django_registration/activation_complete.html create mode 100644 blango_auth/templates/django_registration/activation_email_body.txt create mode 100644 blango_auth/templates/django_registration/activation_email_subject.txt create mode 100644 blango_auth/templates/django_registration/activation_failed.html create mode 100644 blango_auth/templates/django_registration/registration_closed.html create mode 100644 blango_auth/templates/django_registration/registration_complete.html create mode 100644 blango_auth/templates/django_registration/registration_form.html create mode 100644 blango_auth/templates/registration/login.html diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 49606ff1cf46cbb211dfccd9a0243cccd84e6b8c..3ee934009f5989d8de5b28fc5ed17c01f773b454 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=yTpT;tgy&3=-GXt3b delta 15 WcmZo-Y+__L=H=yD+R8AIy&3=-f&-!e diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 2087313128e324eefbdf8682f7f39cc43720241c..5adee381748dc745177b24df1b99332a82d9747a 100644 GIT binary patch delta 360 zcmeySa$l9pn3tE!C{{9ERB9vFY(~be&C3{@7oWIpnpf$i zWF_XM=j$cs7p3auCT8a7B_$?jr{<*;1BLR6^K(-5TtUK45Ydc|5cXW345A_R)cXST%4086-Jn_u&rGO8$p#8p6qDu`eL5jr437ewfR2>r<}f|`N`K;|t@pUmQtu*96w z)FQ*lb%J8%4j@tfl&tua#FE6M#NyQW(xRMOY(ST%Wu`+d1(^Z1-W$a70TS0HpB9wm r0I@W=i;O0J5Y*8L26Cd<5{uIF^Nfl#Knhtw1V{~rF_S%nbQ#?N>%d+s delta 274 zcmcbw`b~w)n3tC;tCt~twd6*w*^G=$o0l;*F|w)#GiU~GHf8SRWYW~${FBF>iE|}G zkp}|W-!YW#PR|Xmw~ug1W0f& z3NW%TaxnsFCLtyvAe)I1tU{B!$Z&F`kd96uP*oILVo`d2o>7rHkW<78B0#1 LPTnY_%jg0C0z^8_ diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index 3bf8a6a57fd436a77bf72d8b9fc8c3208927be18..08bc8caa2abe0258cea175d39d653a3716e69505 100644 GIT binary patch delta 710 zcma)4zi-n(6!zIp?3|s{N!zprwoXx72MGxf0)Z-i?4W{VAz8NX)z~<8b>|c*ONP!J zQ2qfJ*(?Ks)EG8ozD8+`@ZkqyC;9`{k9M8^!rqc+~jUoQGO^J%R>AF zkNEZR;K8z+_h!_mL}7#(xizzWTVgfu`vc6W`Ihg1!A$66!)$b^BJRN;+s<|*rV{T; zY)L$3HtSz$s2hOEwl0a}9B|OH$A)We1T@yDW$G(sviI%#C)Jyf+Ia~{Dk>gUX<58Z;REKzCwW*TDluK`v#gPMaamM6jl6JPz4PWg7mMMw=$w~lX%5rcSfj=0n&YxE@F|w0XILPJ z^H2!?R(o&I@@;4903Pwh(LZP}3gh=sFyV!9m0rllw5`w}U=YodAec^Wu0CsTmdF3= zzrbk-j=zB74?75ZG<9dB(;T8 zI}fW0cp>V}(`P5AFTN<;MGbdXr~2dDM+kLd5*xSEd{vW}ohE8yhp4zI=@LilBKiZv CZPGRX delta 251 zcmey)vw>6Dn3tDpX)8mz84Cl$V+JI^0c1M>aq*Oi%2x4AIh;{ksq86isjOMtSv<{5 zKsI|SR~By;ADGPnX7hvDoM5&<3RenuFLOFelwc}zmQc}zR6(E~o>Y!hMxcJiW~OvT zbA~9v6sBMXP2SBCj0>11KV!Dw<%*9_NlhwEkB`^a6rOyGC0vjzDJMT&uPigQy!aLi zh&_27tG?_l?$V;1g2a-N)S|rNTdXdwPND8A8H$8~E-n(D%)w?aBLQTxFmf>R0HFXA Q2P=r?VH9CzV`O3k0N!ml11Iy=H=yTpT@G0orwtm9)bf_ delta 16 XcmeBV>11Iy=H=yD+RCtzorwtm9@+z6 diff --git a/blango/settings.py b/blango/settings.py index 0985361d68..c1064c62d2 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -207,7 +207,10 @@ class Dev(Configuration): CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" CRISPY_TEMPLATE_PACK = "bootstrap5" INTERNAL_IPS = ["192.168.10.226"] + EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" + ACCOUNT_ACTIVATION_DAYS = 7 + class Prod(Dev): BASE_DIR = Path(__file__).resolve().parent.parent DEBUG = True diff --git a/blango/urls.py b/blango/urls.py index 3725147eec..7cf1127d71 100644 --- a/blango/urls.py +++ b/blango/urls.py @@ -17,8 +17,11 @@ from django.conf import settings from django.contrib import admin from django.urls import path, include +from django_registration.backends.activation.views import RegistrationView +from blango_auth.forms import BlangoRegistrationForm import blog.views +import blango_auth.views @@ -26,7 +29,14 @@ path('admin/', admin.site.urls), path("ip/", blog.views.get_ip), path("", blog.views.index), - path("post//", blog.views.post_detail, name="blog-post-detail") + path("post//", blog.views.post_detail, name="blog-post-detail"), + path("accounts/", include("django.contrib.auth.urls")), + path("accounts/profile/", blango_auth.views.profile, name="profile"), + path( + "accounts/register/", + RegistrationView.as_view(form_class=BlangoRegistrationForm), + name="django_registration_register",), + path("accounts/", include("django_registration.backends.activation.urls")), ] if settings.DEBUG: diff --git a/blango_auth/__pycache__/__init__.cpython-36.pyc b/blango_auth/__pycache__/__init__.cpython-36.pyc index 7ae43cb310f32a52d2a82e40b88d3134ab712e07..fd69ae8b46cf127f41168e53b6148c7103884537 100644 GIT binary patch delta 15 WcmZo?Y-eOQ=H=yTpT;tgy#W9k!~>`R delta 15 WcmZo?Y-eOQ=H=xI>1LS7-T(j@O9N&A diff --git a/blango_auth/__pycache__/admin.cpython-36.pyc b/blango_auth/__pycache__/admin.cpython-36.pyc index 5cb200fcfa4c7f67a82105350edfcf3966dc725c..088c12d8d68ec3c7c2a294ec679a172111dc5f89 100644 GIT binary patch delta 16 XcmdnSv5kY>n3tEUeHzO~c6}BAB$NZ^ delta 16 XcmdnSv5kY>n3tF9#1w{&?D{MKCOZTo diff --git a/blango_auth/__pycache__/apps.cpython-36.pyc b/blango_auth/__pycache__/apps.cpython-36.pyc index 81530418c10a33fa7dac983a5bbcbea4013d6b7e..9615ca7c2f3113fb3690b8555c9fe0f586f4adfd 100644 GIT binary patch delta 16 XcmZ3;ypWmQn3tEUeHzO~_F0SoB4q>{ delta 16 XcmZ3;ypWmQn3tC;q?=(Q`z%HPAgTk| diff --git a/blango_auth/__pycache__/forms.cpython-36.pyc b/blango_auth/__pycache__/forms.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f5f29d2be94e48770db586ebd2b782a47aa11d3c GIT binary patch literal 974 zcmZ`%&5qMB5VjNNr==CEB9K-bIOo!WxFWPd2)NJ#D=xlR+1PE; zpSKrP*?@QQNzF^!n7k?L72bh=?6Xy-z=wx{f#I-YFp6+02@imf$^Zxh6)qW2vRg8v zGL-Bl<N?ZLYf$69Ke~;85xB#5{nVH@{y@7Imd2MJ>yEa#fp4yUq(Wx$sf% z7m>HkVlo4P?0CI#40(HiU;{8IHA7emOaey;6D4~H(>@2&kcMu_E?5Rzx(&WUMVoL( zwnVTkS+Zr+#3`wpy literal 0 HcmV?d00001 diff --git a/blango_auth/__pycache__/models.cpython-36.pyc b/blango_auth/__pycache__/models.cpython-36.pyc index 4e20cf48e445fdbbc9503544d42364b5db1d4fe8..400798038b6bc9df8dde36d9a78bb590c3e6fdcd 100644 GIT binary patch delta 16 XcmeC>>*ZrN=H=yTpT@G0osAs;ARhyJ delta 16 XcmeC>>*ZrN=H=x|pUkk4osAs;9~lEw diff --git a/blango_auth/__pycache__/views.cpython-36.pyc b/blango_auth/__pycache__/views.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8111fed8df861b31f9aee9df034761128dcef7e8 GIT binary patch literal 404 zcmYjMJx{|h5cNmXR8?9rGO=e#gkVGniMnaZVGx6jdB(^f(iq6?#Z+0=#g=rk9P2vqELKX&cXTXBL cY0wx<{VP*^=w~;z5uKK|{(S4Hh(|Qye{7v%WB>pF literal 0 HcmV?d00001 diff --git a/blango_auth/forms.py b/blango_auth/forms.py new file mode 100644 index 0000000000..bc7abbac83 --- /dev/null +++ b/blango_auth/forms.py @@ -0,0 +1,15 @@ +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Submit +from django_registration.forms import RegistrationForm + +from blango_auth.models import User + + +class BlangoRegistrationForm(RegistrationForm): + class Meta(RegistrationForm.Meta): + model = User + + def __init__(self, *args, **kwargs): + super(BlangoRegistrationForm, self).__init__(*args, **kwargs) + self.helper = FormHelper() + self.helper.add_input(Submit("submit", "Register")) \ No newline at end of file diff --git a/blango_auth/migrations/__pycache__/0001_initial.cpython-36.pyc b/blango_auth/migrations/__pycache__/0001_initial.cpython-36.pyc index ee76e9c58377ecdcce2b1464808dfd74af2c7f16..7ef90e9b286dde34fbca44d275ef0bff44aeaff5 100644 GIT binary patch delta 16 XcmeAX>Jef$=H=yTpT@G0os|;+AaMhN delta 16 XcmeAX>Jef$=H=yD+RLz!os|;+Ao&B6 diff --git a/blango_auth/migrations/__pycache__/0002_auto_20241005_0122.cpython-36.pyc b/blango_auth/migrations/__pycache__/0002_auto_20241005_0122.cpython-36.pyc index 2d3eecbbd96c65f8f43bfccfeb3252e6fee40736..62f60b4a77dbeb07e6932d8c41c85d5df87fdf01 100644 GIT binary patch delta 16 XcmZ3+wv3J4n3tEUeHzO~c6nw1B3lEp delta 16 XcmZ3+wv3J4n3tF9#1w{&?DEV2Bmx8N diff --git a/blango_auth/migrations/__pycache__/__init__.cpython-36.pyc b/blango_auth/migrations/__pycache__/__init__.cpython-36.pyc index c99af90076e283d091da1ccf9a49490e81d908f6..534e6e96045772ebc398ff8f963f4cf0c4841c3d 100644 GIT binary patch delta 15 WcmbQlIEj(nn3tEUeHzO|_HFLogged in as {{ request.user }}.

+

Log Out

+ {% endcol %} +{% endrow %} +{% endblock content %} \ No newline at end of file diff --git a/blango_auth/templates/django_registration/activation_complete.html b/blango_auth/templates/django_registration/activation_complete.html new file mode 100644 index 0000000000..1453e28091 --- /dev/null +++ b/blango_auth/templates/django_registration/activation_complete.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% load crispy_forms_tags blog_extras %} +{% block title %}Activation Complete{% endblock %} +{% block content %} +{% row "justify-content-center" %} + {% col "col-md-6" %} +

Activation Complete

+

Your account is now activated! You can now log in and use Blango.

+

Log In

+ {% endcol %} +{% endrow %} +{% endblock %} \ No newline at end of file diff --git a/blango_auth/templates/django_registration/activation_email_body.txt b/blango_auth/templates/django_registration/activation_email_body.txt new file mode 100644 index 0000000000..5faf606264 --- /dev/null +++ b/blango_auth/templates/django_registration/activation_email_body.txt @@ -0,0 +1,10 @@ +Hi, + +You registered for Blango, but you need to activate your account within {{ expiration_days }} days. + +To do that, please visit this page: + +{{ scheme }}://{{ request.get_host }}{% url "django_registration_activate" activation_key %} + +Thanks, +The Blango Team \ No newline at end of file diff --git a/blango_auth/templates/django_registration/activation_email_subject.txt b/blango_auth/templates/django_registration/activation_email_subject.txt new file mode 100644 index 0000000000..67646d771b --- /dev/null +++ b/blango_auth/templates/django_registration/activation_email_subject.txt @@ -0,0 +1 @@ +Activate your Blango account! You have {{ expiration_days }} days! \ No newline at end of file diff --git a/blango_auth/templates/django_registration/activation_failed.html b/blango_auth/templates/django_registration/activation_failed.html new file mode 100644 index 0000000000..5631e8a64b --- /dev/null +++ b/blango_auth/templates/django_registration/activation_failed.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% load crispy_forms_tags blog_extras %} +{% block title %}Activation Failed{% endblock %} +{% block content %} +{% row "justify-content-center" %} + {% col "col-md-6" %} +

Activation Failed

+

Sorry, we couldn't activate your account.

+

{{ activation_error.message }}

+ {% endcol %} +{% endrow %} +{% endblock %} \ No newline at end of file diff --git a/blango_auth/templates/django_registration/registration_closed.html b/blango_auth/templates/django_registration/registration_closed.html new file mode 100644 index 0000000000..b15b741712 --- /dev/null +++ b/blango_auth/templates/django_registration/registration_closed.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load crispy_forms_tags blog_extras %} +{% block title %}Registration Closed{% endblock %} +{% block content %} +{% row "justify-content-center" %} + {% col "col-md-6" %} +

Registration is currently closed

+ {% endcol %} +{% endrow %} +{% endblock %} \ No newline at end of file diff --git a/blango_auth/templates/django_registration/registration_complete.html b/blango_auth/templates/django_registration/registration_complete.html new file mode 100644 index 0000000000..5a37d3ce5f --- /dev/null +++ b/blango_auth/templates/django_registration/registration_complete.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% load crispy_forms_tags blog_extras %} +{% block title %}Registration Successful{% endblock %} +{% block content %} +{% row "justify-content-center" %} + {% col "col-md-6" %} +

Your registration was successful

+

Check your email to validate your account.

+ {% endcol %} +{% endrow %} +{% endblock %} \ No newline at end of file diff --git a/blango_auth/templates/django_registration/registration_form.html b/blango_auth/templates/django_registration/registration_form.html new file mode 100644 index 0000000000..c7f501a423 --- /dev/null +++ b/blango_auth/templates/django_registration/registration_form.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} +{% load crispy_forms_tags blog_extras %} +{% block title %}Register for Blango{% endblock %} +{% block content %} +{% row "justify-content-center" %} + {% col "col-md-6" %} +

Register for Blango

+ {% crispy form %} + {% endcol %} +{% endrow %} +{% endblock %} \ No newline at end of file diff --git a/blango_auth/templates/registration/login.html b/blango_auth/templates/registration/login.html new file mode 100644 index 0000000000..f74f188909 --- /dev/null +++ b/blango_auth/templates/registration/login.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load crispy_forms_tags blog_extras %} +{% block title %}Log In to Blango{% endblock %} +{% block content %} +{% row "justify-content-center" %} + {% col "col-md-6" %} + {% if next %} + {% if user.is_authenticated %} +

Your account doesn't have access to this page. To proceed, + please login with an account that has access.

+ {% else %} +

Please login to see this page.

+ {% endif %} + {% endif %} + {% endcol %} +{% endrow %} + +{% row "justify-content-center" %} + {% col "col-md-6" %} +
+ {% csrf_token %} + {{ form|crispy }} + + +
+ +

Lost password?

+ {% endcol %} +{% endrow %} +{% endblock %} \ No newline at end of file diff --git a/blango_auth/views.py b/blango_auth/views.py index 91ea44a218..db63e0eee2 100644 --- a/blango_auth/views.py +++ b/blango_auth/views.py @@ -1,3 +1,10 @@ from django.shortcuts import render # Create your views here. +from django.contrib.auth.decorators import login_required +from django.shortcuts import render + + +@login_required +def profile(request): + return render(request, "blango_auth/profile.html") \ No newline at end of file diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index cc55c380a61bd116da636d48a7ab3909daedbe61..b1bb5512cba14cf0855e484c01c73d51decfb4d6 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=yTpT;tgy%GQ!`2&*x delta 15 WcmZo*Y+z(J=H=yD+R8AIy%GQ#NCTVz diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index 0745f9e9eea15c3cd0e43eab6b5536d6f2e31597..accd27a1204db56e1310c01f11b12bbbddd77fb9 100644 GIT binary patch delta 16 XcmZ3^vYdt8n3tEUeHzO~b_FH?B0>YO delta 16 XcmZ3^vYdt8n3tDpX)D71No--ogw394rG- diff --git a/blog/migrations/__pycache__/__init__.cpython-36.pyc b/blog/migrations/__pycache__/__init__.cpython-36.pyc index aea4237b9c23d6430a7501c09a77e5377def8447..de27d799cd8702ad6f3301e5ba80f03cf7b16c07 100644 GIT binary patch delta 15 WcmeBX>}F&)=H=yTpT;tgy#)XpI0Li* delta 15 WcmeBX>}F&)=H=yD+R8AIy#)XphXcI; diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 8303b6bd26909335a39f01151d7e9e8d051e29e6..4706fe47ab3813c561245e514fee62e98e8e8e16 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=yTpT;tgy$t{xas#>m delta 15 WcmeBW>}6y(=H=yD+R8AIy$t{x!2`np diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index 2802ec398a187fd546f3cbf0c26e390b48fe91af..b076c9231590cbbf86f888898f8083e41ad7812d 100644 GIT binary patch delta 16 Xcmcb?cY}}Jn3tEUeHzO~_CR(3DSrf9 delta 16 Xcmcb?cY}}Jn3tDpX)D7<_CR(3Dc1yL diff --git a/db.sqlite3 b/db.sqlite3 index f699856345cc8143e93e4ff6c0392b166f026744..84ea9d8367e7e433df984599f6440f5433e35a2a 100644 GIT binary patch delta 1265 zcmai!&u`jh7{?6+DXAb{w!;pas%necG?A(O`Ukv7n`Rq>0|DbW5a2=#7y|x@F+VSq zW>St>i?pftUU!HxDYvE4t~=~7?NIg9>!e-w2W*f?iPUN8^?e?F-_P@XzVG|=b?E8q z(08Bt#OI&$KJonM*N888fj#*h-&p?{35Fgcs2uuZJrX_%JwBg(8bW8=!4NXz+0}4( zb&cJbAK4G5xlYoO_1#f1Mdyo&N}>T8-J)*nmPs3wu&bZHF}{S3}w?(<%vG50WYJJ zoKnR~wiO|#=31N59sr)B1XlN>dSTXcecKu~dlTwX)R80HTBwt~kZG)~YI zT%xy3wQXF3hXYFzWNjX`PFD~FnLnSM&1L&yJ&3+U(BIHM(JS;N`s2lhbBaFvB(URq zZ}Q+q;L-Kjt>ntd)%5gg>bty}`h}x=fzTPU{wDlW=-wR9eF$T6$FMWP8%E&C2^tEa@ppS(=RM{eFzpcZG_RvRfIA z%wSSgb=X0JwDMB3Y_foGdBW1uS<2jFMUf$ujLE@z1LsKBtxv52r!?%PIzQHe;7}}j4q3~F(~C5q~Ih}a-Sd3q*kqr3z_T`qm>dRxpLbuEd3^5 z1cozr$)jl;Lip@U|H7sM+p19mqp4A_TZ_^yujw$8PJf{4x5kYJ?^VJV^5OBGsqljC?r7YoMknltL}W=;al7oVJ9+LuZ8LsEMO% zJ&EC>3!iRm%7~4m=pO8;Og=W?CVdi5r3a;nI~J%YS5ahZA9|vlD5v^GXKdtnPV&my z0l~tY!!&wrwq(b;y`ca)U4m*36P}%rnqXlR-cFP8UN_5+_m4|FrWC9K6qAVwITEV6 zlqYaOm)w#GU5fV{wZz`OLwFbSWyoXX<(t3!+rE1N^aX;xMK948i=cjsrZ)pw--i+w zST=pgU;htp|M71v^j{(9JMQ`5 ABme*a delta 144 zcmV;B0B`?*zzl%E43HZEJCPhi0Xwl^%q{@~vn?;wFbx0z00Ry#01r_Pz78(2fglc( zE^d$rfe-==0D(gQliqAkq%P5rDA|gTH@=zkdO@zkdQn yUD@s4=zx diff --git a/templates/base.html b/templates/base.html index afe1b7a44b..3d33ebc41e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -4,9 +4,23 @@ - Hello, world! + <title>{% block title %}Welcome to Blango{% endblock %} + {% block content %} {% endblock %} From a948470aff8327491522220f03792d31c085af23 Mon Sep 17 00:00:00 2001 From: Ahmed IIbrahim Date: Mon, 4 Nov 2024 23:51:47 +0000 Subject: [PATCH 15/15] Finish django Allauth --- blango/__pycache__/__init__.cpython-36.pyc | Bin 130 -> 130 bytes blango/__pycache__/settings.cpython-36.pyc | Bin 4831 -> 5125 bytes blango/__pycache__/urls.cpython-36.pyc | Bin 1655 -> 1683 bytes blango/__pycache__/wsgi.cpython-36.pyc | Bin 521 -> 521 bytes blango/settings.py | 11 +++++++++++ blango/urls.py | 1 + .../__pycache__/__init__.cpython-36.pyc | Bin 135 -> 135 bytes blango_auth/__pycache__/admin.cpython-36.pyc | Bin 1078 -> 1078 bytes blango_auth/__pycache__/apps.cpython-36.pyc | Bin 417 -> 417 bytes blango_auth/__pycache__/forms.cpython-36.pyc | Bin 974 -> 974 bytes blango_auth/__pycache__/models.cpython-36.pyc | Bin 1805 -> 1805 bytes blango_auth/__pycache__/views.cpython-36.pyc | Bin 404 -> 404 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 2316 -> 2316 bytes .../0002_auto_20241005_0122.cpython-36.pyc | Bin 806 -> 806 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 146 -> 146 bytes blango_auth/templates/registration/login.html | 3 +++ blog/__pycache__/__init__.cpython-36.pyc | Bin 128 -> 128 bytes blog/__pycache__/admin.cpython-36.pyc | Bin 551 -> 551 bytes blog/__pycache__/apps.cpython-36.pyc | Bin 397 -> 397 bytes blog/__pycache__/forms.cpython-36.pyc | Bin 924 -> 924 bytes blog/__pycache__/models.cpython-36.pyc | Bin 2227 -> 2227 bytes blog/__pycache__/views.cpython-36.pyc | Bin 1563 -> 1563 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 1231 -> 1231 bytes .../__pycache__/0002_comment.cpython-36.pyc | Bin 1035 -> 1035 bytes .../0003_auto_20240907_1018.cpython-36.pyc | Bin 749 -> 749 bytes ...004_alter_post_published_at.cpython-36.pyc | Bin 599 -> 599 bytes .../0005_auto_20240924_1811.cpython-36.pyc | Bin 669 -> 669 bytes .../0006_authorprofile.cpython-36.pyc | Bin 907 -> 907 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 139 -> 139 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 141 -> 141 bytes .../__pycache__/blog_extras.cpython-36.pyc | Bin 1880 -> 1880 bytes db.sqlite3 | Bin 204800 -> 290816 bytes 32 files changed, 15 insertions(+) diff --git a/blango/__pycache__/__init__.cpython-36.pyc b/blango/__pycache__/__init__.cpython-36.pyc index 3ee934009f5989d8de5b28fc5ed17c01f773b454..90db682925db79eebf5df38b51e0cb8f858613c8 100644 GIT binary patch delta 15 WcmZo-Y+__L=H=zGiqM?MUJU>j!viw_ delta 15 WcmZo-Y+__L=H=yTpT;tgy&3=-GXt3b diff --git a/blango/__pycache__/settings.cpython-36.pyc b/blango/__pycache__/settings.cpython-36.pyc index 5adee381748dc745177b24df1b99332a82d9747a..6cc259b81cece80a11e70f9d7cd42e7482dbfaec 100644 GIT binary patch delta 740 zcmZvZO>@#f7{{{_3Pmdvt1}E%twJT*rZ0%^(xxPp*aR#DY#$Fy%EP2_kZ1xPdg;k8 zV6MG*arEGf9WHwHV{mc&1YY&xxJye<&d&4O|Ni&CZ?iwrZ!?kX#6;xVbHUn89!B1g zNQ~pSRa)Lh{{#88k6FBhIlPT`tQaKmF5biY_y8Z`BWnyUVjiY(rF9lplbl5`ffBA^ z0cBLIfK71yAYc)=gpc7e7Ez_SCrJ)B4tSfu71U6t84XKAmWO<56Dt5SxCvJ=0oQOP z0VyidSb%6hC<$9v!I99vWe;=*~#s|UHOVe%(%l$uR9DW}{Rn<@$sthwyp-`@sj7F`h zR2q6&Ranv!ZpQ7IW}K{C{G zsi7-Iu`GWIbM6NHUU$QP9nF)k{+DReACHwn0X{%z>l?8gNu^jK%`nTrGt4uH3=0g4 z{^v;{vqa@!T(iAy-E8+-?lK$4WV37Tm|m+^(T;4%|2sLIKRTB!9x9C~o#H1gZ;B#J zV)PCXLVG^W$EoJYFd>|Fv;KB`ZqA@77&BeV=`6bf9k@XTw#)IePL$>!#^*`p9~aij AC;$Ke delta 458 zcmZXPOD{uF6ov1(s?j#3)sR%xv!$2Tqu%eLl&WV#G@LYpv0n=y~1$SnjE zEIz0Pp)E*ZNn}!3E-_u=ib0r-wjx8@;HT|EA)zo#9ww$FXBmwU~A1&Z~}R#Y~H5%rw99Op{0c>N(=Q-lTQu zjgwHjoP;F85~@U0A|}xz(aYazwf#O}KOGsPaK59TUgXSvS$mTDxqhe@a@$*(zji{l zYjARa^5o#cJpHsE<(E OO32K=HT=UDBdK5ZZgm0x diff --git a/blango/__pycache__/urls.cpython-36.pyc b/blango/__pycache__/urls.cpython-36.pyc index 08bc8caa2abe0258cea175d39d653a3716e69505..69daf2c87c0443ec27d6f714b2ff5961da6b5139 100644 GIT binary patch delta 128 zcmey)GnrS}n3tF9WVB{_8XE({V+JI^17te@aq*vt%IA$z*;DvZIa0)$8Jn5XIin;~ znX{ydexynQ#l=%OQW>*^z%q>H3{jFPOu-DA5}PF$w=#3^B5}KF-p>$f!5j QgH4lzhf#o;jgg5F02&G$P5=M^ delta 105 zcmbQt`<+MGn3tD}IY~0zjE#ZeF#{6d2C^N1xcI|F<@0Lk98r>~%vn-JZ&D>w*;B+) xIZ_$3gqj(fnbH}}8KNXpn1UHJ#W$-kZe`y5oTZA9QD<@zn11Iy=H=zGiqPE1&cp-&8>|BG delta 16 XcmeBV>11Iy=H=yTpT@G0orwtm9)bf_ diff --git a/blango/settings.py b/blango/settings.py index c1064c62d2..495fa886cf 100644 --- a/blango/settings.py +++ b/blango/settings.py @@ -113,11 +113,16 @@ class Dev(Configuration): "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", + "django.contrib.sites", "django.contrib.staticfiles", "blog", "crispy_forms", "crispy_bootstrap5", "debug_toolbar", + "allauth", + "allauth.account", + "allauth.socialaccount", + "allauth.socialaccount.providers.google" ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', @@ -210,6 +215,12 @@ class Dev(Configuration): EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" ACCOUNT_ACTIVATION_DAYS = 7 + SITE_ID = 1 + ACCOUNT_USER_MODEL_USERNAME_FIELD = None + ACCOUNT_EMAIL_REQUIRED = True + ACCOUNT_USERNAME_REQUIRED = False + ACCOUNT_AUTHENTICATION_METHOD = "email" + class Prod(Dev): BASE_DIR = Path(__file__).resolve().parent.parent diff --git a/blango/urls.py b/blango/urls.py index 7cf1127d71..7410f7e514 100644 --- a/blango/urls.py +++ b/blango/urls.py @@ -37,6 +37,7 @@ RegistrationView.as_view(form_class=BlangoRegistrationForm), name="django_registration_register",), path("accounts/", include("django_registration.backends.activation.urls")), + path("accounts/", include("allauth.urls")), ] if settings.DEBUG: diff --git a/blango_auth/__pycache__/__init__.cpython-36.pyc b/blango_auth/__pycache__/__init__.cpython-36.pyc index fd69ae8b46cf127f41168e53b6148c7103884537..405396ee43ece4594426e8fde634c85412e85ab5 100644 GIT binary patch delta 15 WcmZo?Y-eOQ=H=zGiqM?M-T(j?R0Bc) delta 15 WcmZo?Y-eOQ=H=yTpT;tgy#W9k!~>`R diff --git a/blango_auth/__pycache__/admin.cpython-36.pyc b/blango_auth/__pycache__/admin.cpython-36.pyc index 088c12d8d68ec3c7c2a294ec679a172111dc5f89..53df26584dd0aec9372136f0847785c874a01238 100644 GIT binary patch delta 16 XcmdnSv5kY>n3tE!DnfH3yFLp5A-)5F delta 16 XcmdnSv5kY>n3tEUeHzO~c6}BAB$NZ^ diff --git a/blango_auth/__pycache__/apps.cpython-36.pyc b/blango_auth/__pycache__/apps.cpython-36.pyc index 9615ca7c2f3113fb3690b8555c9fe0f586f4adfd..27896673f38af99fa55d0aa14c8ecd910d8f3fae 100644 GIT binary patch delta 16 XcmZ3;ypWmQn3tE!DnfH3`z%HPACCjI delta 16 XcmZ3;ypWmQn3tEUeHzO~_F0SoB4q>{ diff --git a/blango_auth/__pycache__/forms.cpython-36.pyc b/blango_auth/__pycache__/forms.cpython-36.pyc index f5f29d2be94e48770db586ebd2b782a47aa11d3c..3521052fa63c62a97055a8dd63501e3d6659192c 100644 GIT binary patch delta 40 tcmX@devX~pn3tE!DnfH3dngm*t;w-WYZ=8Rb2BRe*?P>9K+=P`4FKFa3myOf delta 40 tcmX@devX~pn3tDpPNL*S_E09qsL8QRYZ*l+b2BRe*?P>9K+=P`4FJ={3HSg2 diff --git a/blango_auth/__pycache__/models.cpython-36.pyc b/blango_auth/__pycache__/models.cpython-36.pyc index 400798038b6bc9df8dde36d9a78bb590c3e6fdcd..c7a906e5e4a113854ef92f5514a139d70c33f5b6 100644 GIT binary patch delta 16 XcmeC>>*ZrN=H=zGiqPE1&c+S^9Z3Tf delta 16 XcmeC>>*ZrN=H=yTpT@G0osAs;ARhyJ diff --git a/blango_auth/__pycache__/views.cpython-36.pyc b/blango_auth/__pycache__/views.cpython-36.pyc index 8111fed8df861b31f9aee9df034761128dcef7e8..c56b0a7e03548aa2156e8f128846b6e3e3b33860 100644 GIT binary patch delta 16 XcmbQjJcXIvn3tE!DnfH3doLpZ9q$8< delta 16 XcmbQjJcXIvn3tF9b{XGB_FhH+B7+1n diff --git a/blango_auth/migrations/__pycache__/0001_initial.cpython-36.pyc b/blango_auth/migrations/__pycache__/0001_initial.cpython-36.pyc index 7ef90e9b286dde34fbca44d275ef0bff44aeaff5..6e86b3650309cbf9833f91a8c3a80c09f30eceea 100644 GIT binary patch delta 16 XcmeAX>Jef$=H=zGiqPE1&dLb@9h(Cj delta 16 XcmeAX>Jef$=H=yTpT@G0os|;+AaMhN diff --git a/blango_auth/migrations/__pycache__/0002_auto_20241005_0122.cpython-36.pyc b/blango_auth/migrations/__pycache__/0002_auto_20241005_0122.cpython-36.pyc index 62f60b4a77dbeb07e6932d8c41c85d5df87fdf01..bddfdedb41da0077ea07e28cafa46b63afbb4e2f 100644 GIT binary patch delta 16 XcmZ3+wv3J4n3tE!DnfH3yF4=hAB6)< delta 16 XcmZ3+wv3J4n3tEUeHzO~c6nw1B3lEp diff --git a/blango_auth/migrations/__pycache__/__init__.cpython-36.pyc b/blango_auth/migrations/__pycache__/__init__.cpython-36.pyc index 534e6e96045772ebc398ff8f963f4cf0c4841c3d..d3b1f1ffeee5b09ac466c496f8c921a056cdd531 100644 GIT binary patch delta 15 WcmbQlIEj(nn3tE!DnfH2dp7_XlLKP_ delta 15 WcmbQlIEj(nn3tEUeHzO|_HF

Lost password?

+

+ Log in with Google +

{% endcol %} {% endrow %} {% endblock %} \ No newline at end of file diff --git a/blog/__pycache__/__init__.cpython-36.pyc b/blog/__pycache__/__init__.cpython-36.pyc index b1bb5512cba14cf0855e484c01c73d51decfb4d6..d2c2acd84ed831b550052d13e1bfff0f5f536bac 100644 GIT binary patch delta 15 WcmZo*Y+z(J=H=zGiqM?MUI_pfi32SF delta 15 WcmZo*Y+z(J=H=yTpT;tgy%GQ!`2&*x diff --git a/blog/__pycache__/admin.cpython-36.pyc b/blog/__pycache__/admin.cpython-36.pyc index accd27a1204db56e1310c01f11b12bbbddd77fb9..f212fda0f35adee628186aa4d4dc2afd40f63b1b 100644 GIT binary patch delta 16 XcmZ3^vYdt8n3tE!DnfH3y8;scA8Z3k delta 16 XcmZ3^vYdt8n3tEUeHzO~b_FH?B0>YO diff --git a/blog/__pycache__/apps.cpython-36.pyc b/blog/__pycache__/apps.cpython-36.pyc index 8069876237853c7ca9aca6236ea818cefdd85144..73aa7407f91278680a0d79aff0b52ddd3bfb5181 100644 GIT binary patch delta 16 XcmeBW?qy~-=H=zGiqPE1-o^+39S;L} delta 16 XcmeBW?qy~-=H=yTpT@G0y^Rq7ALRqz diff --git a/blog/__pycache__/forms.cpython-36.pyc b/blog/__pycache__/forms.cpython-36.pyc index 69d4ad9fd6589d0359d9c92f9862ef191aa318f5..dd3d3451931c0c2104aade3788b2a1fe9e7dbb67 100644 GIT binary patch delta 60 zcmbQkK8Ky%n3tE!DnfH3yAu=Rt;t?Ya~UNjzhH8dz9pPolv!L*8K0J4lv}KqlUSKw QT2jQqz`$^8vI}zr03Qbv00000 delta 60 zcmbQkK8Ky%n3tEUeHzO~b|)srsL5VTa~Z`azhH8djuK8T$}BFZj8Dri$}QH*NvzB- QEh%DQU|@)v?7|!Y01Lno}F&)=H=zGiqM?M-U0v^$OBFQ delta 15 WcmeBX>}F&)=H=yTpT;tgy#)XpI0Li* diff --git a/blog/templatetags/__pycache__/__init__.cpython-36.pyc b/blog/templatetags/__pycache__/__init__.cpython-36.pyc index 4706fe47ab3813c561245e514fee62e98e8e8e16..5ecea1595ebcc6cfde18fe4b1989cbd6d0bcef8b 100644 GIT binary patch delta 15 WcmeBW>}6y(=H=zGiqM?M-Ua{}0s~Y4 delta 15 WcmeBW>}6y(=H=yTpT;tgy$t{xas#>m diff --git a/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc b/blog/templatetags/__pycache__/blog_extras.cpython-36.pyc index b076c9231590cbbf86f888898f8083e41ad7812d..46b4fb6317d49b29a82db72accb686346fcb48f8 100644 GIT binary patch delta 22 ecmcb?cY}}Jn3tE!DnfH3`%yN=Ta(YSbprrPmc!QIpTIbprrSQU@CV diff --git a/db.sqlite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