From 63ee0aa9c7aa304dde46d5fd2678e2b07f3f2c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Klepacki?= Date: Wed, 30 Dec 2020 22:49:17 +0100 Subject: [PATCH] popup --- .../__pycache__/settings.cpython-37.pyc | Bin 2512 -> 2512 bytes .../__pycache__/urls.cpython-37.pyc | Bin 489 -> 489 bytes .../__pycache__/models.cpython-37.pyc | Bin 1028 -> 1056 bytes .../homepage/__pycache__/views.cpython-37.pyc | Bin 6609 -> 7243 bytes .../migrations/0002_product_wolontatriat.py | 18 ++ .../0002_product_wolontatriat.cpython-37.pyc | Bin 0 -> 573 bytes .../templates/homepage/add_offer.html | 14 +- .../templates/homepage/create_user.html | 170 +++++++++++++++++- .../templates/homepage/edycja_ogloszenia.html | 12 ++ SocialHelper/homepage/views.py | 40 ++++- 10 files changed, 251 insertions(+), 3 deletions(-) create mode 100644 SocialHelper/homepage/migrations/0002_product_wolontatriat.py create mode 100644 SocialHelper/homepage/migrations/__pycache__/0002_product_wolontatriat.cpython-37.pyc diff --git a/SocialHelper/SocialHelper/__pycache__/settings.cpython-37.pyc b/SocialHelper/SocialHelper/__pycache__/settings.cpython-37.pyc index 8cc1645092a82344c23ac8df94e3e6e5b42a5c8c..66f78c35dd09b206284458444b532c9597b0f3c4 100644 GIT binary patch delta 20 acmca0d_kDoiIp@F^Uz;W(Kp_ zfNXZ4IAaP+3TrQO6bF#cnZlOJmBpRK1608j#S0YSOXUZW0x9f3z95h#lq#IUoWha9 z3DhA1=8MAlVnDul3Kx)X&XK|mR3HHs-~lTD@g?C3Ao5aZ^3s!g7^NBACNF0+n|zPa rno(x56q7w)6i;}5PJUiVVo6bEV#(%6CVobCF`)lA7mzD8ie{2PFAZ*noTiAWJY+D1|+RBZU*FLm12# zf%8Rye6bWRFrOPJFAnCr@xTQn&=g35`3QNb6y9J4O}<;~0Y&*KrO72BnvA#DQ&Q6s nOLIylZ(%fJbesH&(V9_uvKo{9=3*v(MphA^-#8|BGEWBp7?wQP diff --git a/SocialHelper/homepage/__pycache__/views.cpython-37.pyc b/SocialHelper/homepage/__pycache__/views.cpython-37.pyc index e4258823dde83dbbb87556befbf112a77b2a26a8..b336f0170594643bed690486a8f77c399a77da91 100644 GIT binary patch delta 2147 zcmZWq&2JM&6yMohuh;9{jh&FhP!J9&G!9h*t)PJVfhZqUDS;A7O879AcLO%Tc4x;* zh}JS{q+SrGIrY*ys#K|m9$Nl^eqPF{s?>vvP*0UAaikY|>FM?BBb@VouzqvD;ym;P5tHYdMHF0=FZ4%!bHyKpb(e6BMgzjYTT(+G5N zzkxgY1rTdht;+b1_}2q=L+4-1*S)DWTqCeHYpq0_2$C2+8`v$YW(KL2CCpA@U27!~ zWAO%I;2_e*Y`SHul`j00NXB+-#T2IrJJ#12Ftx^FGd5xtc!7V{X*sdeNv&&46HX@` zYr)XE4tu*Ryfrqb2_Hk5H64~KhG-uK4>WeMEGV zQL|hQqllaE_yGcgzycJ~@;iTTrklcpi%a!#X^B%FOkh|CdT#tWn#qY+cxH1TBq}Ou|rv>eek0v(>drV(H?+6t*Sbb$L_M09_X=NG-ADD zt`{kTiH?PI87hNGVN<#a=4^rSeOP+DIR+feKr?FAD&K!3!ihqPXEDk1fUa>Z6r5uD z+XR#qeo8(VIyQ43W~8{re4HI;*7*gDZJd{4H_rP=&SqXQsB~3 z;Iz_;EvR@k$v-3vh%;{N;+2R)R^Y++;`AcJNJ=KhDo(5!ibq4)1ABTD;z#L4rwPUZ|I1bw+!FO= zMVT|%9p3oA8RO?=JDY32MN5wn949zQK!oV+d4#MJ1cwOTBpApqxlc2$;PXiuohNvY zU^Brsf}I3g2xbXR6SU6|zC%EC;b#fv2zG72bFjKj7*s^DzPK3jpW#QZ05lZTWTsB! zwDk@8!s^l20&y+f0ZnO+h>NRFTE2kwWhNWLo7%s_q;^+I@<6aPt;OJjsVJtdECUue z8<-%%VPSMk)FYuNn+Pn`;mKIPk>r>9bN1j|Y^ZfB{kharbF4aJRk1j5?y`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E53;B!xg#Rz}BzP<|P_PJ%5r^=GbW3&D zfOHdeGzo9YcInH)2E^52GCbKF9ez{R%Hrwc)zppfK91lXgUo2%Q9N>##f!p{f0RGT z9sjf_zc4E^xt-2drz?~$J}!-+$RZ>Z9X_a>BC~i|s1wa^poN_B20{}dlK)h%`99O( Rt+HkIBs1A8D>4SY_aAZ;AtV3* diff --git a/SocialHelper/homepage/migrations/0002_product_wolontatriat.py b/SocialHelper/homepage/migrations/0002_product_wolontatriat.py new file mode 100644 index 0000000..cbeedca --- /dev/null +++ b/SocialHelper/homepage/migrations/0002_product_wolontatriat.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.4 on 2020-12-30 21:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('homepage', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='product', + name='Wolontatriat', + field=models.BooleanField(default=False), + ), + ] diff --git a/SocialHelper/homepage/migrations/__pycache__/0002_product_wolontatriat.cpython-37.pyc b/SocialHelper/homepage/migrations/__pycache__/0002_product_wolontatriat.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e04abaa5163c4e4d3b9a84f9c0e626ab8b4928ad GIT binary patch literal 573 zcmY*W%}T>S5Z=wEX<90H&{q%wQmRK0QNh211?fQyg=OtbYsw}YlN9l+*Is-JUumzN z1bqQd&ZaHZ2|LWsm)Y-|J>A%7GqS_)FZsq9`*6w1dtbPLoNYs>Eca4N?QB%aLoXETG_+PPt1CS-F|zk|kB5v~A{vf!V0C zom-<#R;j8;RCOM4+XNh|nXV#1EFCkMsT8eW`^Gpy4gIKPLs{3Qv~4K~H`7RQN6N>U z(hln~z#KEcY?NSGcqGM!CjjSeMj>3*ku)BHE_^ZFsoYz>yPGI-#557Xjp(?EnA( literal 0 HcmV?d00001 diff --git a/SocialHelper/homepage/templates/homepage/add_offer.html b/SocialHelper/homepage/templates/homepage/add_offer.html index 206ebb4..75a3f39 100644 --- a/SocialHelper/homepage/templates/homepage/add_offer.html +++ b/SocialHelper/homepage/templates/homepage/add_offer.html @@ -35,7 +35,7 @@ - +
@@ -49,6 +49,18 @@
+
+
+
+ + +
+
+
+
diff --git a/SocialHelper/homepage/templates/homepage/create_user.html b/SocialHelper/homepage/templates/homepage/create_user.html index d86980a..574a9f1 100644 --- a/SocialHelper/homepage/templates/homepage/create_user.html +++ b/SocialHelper/homepage/templates/homepage/create_user.html @@ -3,6 +3,92 @@ {% block content %} + + + + @@ -32,7 +118,7 @@
-
+
@@ -43,6 +129,61 @@
+
+
+
+ + + + +
+
+
+ +
@@ -142,6 +283,33 @@ Copyright © All r
+ {% endblock %} diff --git a/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html b/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html index d19f9fa..92163d3 100644 --- a/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html +++ b/SocialHelper/homepage/templates/homepage/edycja_ogloszenia.html @@ -59,6 +59,18 @@
+
+
+
+ + +
+
+
+
diff --git a/SocialHelper/homepage/views.py b/SocialHelper/homepage/views.py index 8b52b2c..f84b88a 100644 --- a/SocialHelper/homepage/views.py +++ b/SocialHelper/homepage/views.py @@ -80,7 +80,6 @@ def index_offer(request): } return HttpResponse(template.render(context, request)) - def contact(request): return render(request , 'homepage/contact.html') @@ -168,6 +167,14 @@ def add_offer(request): type_local = request.POST['type'] script_local = request.POST['script'] title_local = request.POST['title'] + + + wol_local = request.POST['wol'] + if wol_local == "1": + wol = False + else: + wol = True + data_local = timezone.now() if request.FILES: pic_local = request.FILES['file'] @@ -176,6 +183,7 @@ def add_offer(request): offer_local = request.POST['offer'] product = Product( picture = pic_local, + Wolontatriat = wol, create_date = data_local, user_iden = request.user, type = int(type_local), @@ -186,6 +194,7 @@ def add_offer(request): keywords = "", ) product.save() + messages.success(request, 'Ogłoszenie dodane!') return redirect(my_offer) return render(request , 'homepage/add_offer.html') else: @@ -195,6 +204,7 @@ def delete_offer(request, offer_id): instance = Product.objects.get(id=offer_id) instance.active = False instance.save() + messages.success(request, 'Ogłoszenie usunięte!') return redirect(my_offer) @@ -212,12 +222,20 @@ def edit_offer(request, offer_id): type_local = request.POST['type'] script_local = request.POST['script'] title_local = request.POST['title'] + + wol_local = request.POST['wol'] + if wol_local == "1": + wol = False + else: + wol = True + if request.FILES: pic_local = request.FILES['file'] instance.picture = pic_local offer_local = request.POST['offer'] + instance.Wolontatriat = wol, instance.type = int(type_local) instance.offer = int(offer_local) instance.title = title_local @@ -226,6 +244,7 @@ def edit_offer(request, offer_id): instance.keywords = "" instance.save() + messages.success(request, 'Ogłoszenie edytowane!') return redirect(my_offer) return render(request , 'homepage/edycja_ogloszenia.html', context) @@ -234,6 +253,18 @@ def create_user(request): User = get_user_model() email = request.POST['email'] password = request.POST['password'] + if email == "": + messages.error(request,'Pole email jest puste!') + return redirect('create_user') + + if "@" not in email: + messages.error(request,'Wprowadzony email jest niepoprawny!') + return redirect('create_user') + + if password == "": + messages.error(request,'Pole hasło jest puste!') + return redirect('create_user') + if User.objects.filter(email=email).exists(): messages.error(request,'Ten adres e-mail jest już używany') return redirect('create_user') @@ -255,7 +286,14 @@ def delete_user(request): User = get_user_model() instant = User.objects.filter(id=request.user.id).first() instant.is_active = False + instant.email = str(instant.id) + instant.username = str(instant.id) + instant_offer = Product.objects.filter(user_iden = instant) + for offer in instant_offer: + offer.active = False + offer.save() instant.save() + messages.success(request,'Konto skasowane!') return redirect(index)