From 7cfc68a2089cdae8ea471dba8c9ec1ee1e9a53aa Mon Sep 17 00:00:00 2001 From: emile Date: Thu, 14 Sep 2023 16:59:29 +0300 Subject: [PATCH] Requirements are now dynamic --- osinaweb/db.sqlite3 | Bin 294912 -> 294912 bytes .../__pycache__/views.cpython-310.pyc | Bin 6386 -> 6502 bytes osinaweb/osinacore/views.py | 19 ++++++++++-------- osinaweb/templates/create-project.html | 8 ++++---- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3 index a08e60dbc191a238732052d8facc232296600d72..74d4e51c31f48be46735fb40a1cab59c23a5b91e 100644 GIT binary patch delta 1324 zcmd6lTWl0%7=~wdc3S83zdfYT+NCTkB*eJu9NNxqV?tWGu_C)*15}JDw%wuahGm!T zq*!Cp2Gl!*+UO)2FBB!gG!V0kdjSaq6BAbxS~a01gvMhGsR2)rr~&_(a?l$!@y46) z{pZj3KJ(>&zln*OiHVxSjcjrwli>^+gMPRrS7g`$Gz!IIykVG)4xqt)tdJf7*@?skvCj9M0y)`UdRbUC;JsTBZ)a zUfejCc`VsBu%pL{ZBo0pk9Oty?9Ps!WFoOS*S$UeWS?m#ti3z;C9R}s8AEnfS9K$- z#=?3usNEaS)Qwo7cj~AdkV%|D7db@cQ9_8s@iMtdipY>OE)_I&Em^yUOR)bmnsOk0 zyp%r9zSd5G2N`^cxA6jY;R8H^br8rE@-dkv2Mg6tXNWU>ldZyEXHiP@@`>5|C6pQb zjvM$9-{U)ch0B=7=QxjYp*r^_oHGkP$thpuRy&IezIxhTWbi9~!Xmz*trswZk8lpB zP^9gzBEZXjh81L9az)}rS43WLMQ~=W`kMbE;g(1En~|sS=V_HRgZJ?q;!wzEWSn#n zDD%n@C0)>ho0M@=7MbOBD_03ZcOm4SjTdBK2#?i#IGCj50XTd~s=Q}L=>+_b=l%f9MRKkH delta 596 zcmcIfOGs2v7{2G8aUPBSpH6P_#h_pkH0oq3(_&K5ZV*_wl`$zpFNuS;3>-?^g!T|Q z;5r3E6uHuc5(?c!ZSK&*G2{-FN{EqKD3pwzk(Rl1`@O$d%omIKp60XAvx0_P8I80C&NYz`_z>{aQ7}{$3{}(yDyuJ6*VGta zdP@9xULH~CbLOzO^HhD-oTtFG>$EanItF;eXwSaPjmXGEW}cUH1sXk}Wtb?zb4t-1 zx=F{1k#qAJJ=CX7eVUEcN#T@&uXuq$+`%HQpbQ?`ppP^qg~KFKVH0bx zu>?!nUPD+v)vDvkgCp`kh41k%mNW&ga377xqEFOMnj9P?Q!C>0Oy7=_|)bA diff --git a/osinaweb/osinacore/__pycache__/views.cpython-310.pyc b/osinaweb/osinacore/__pycache__/views.cpython-310.pyc index c0c1c1a439a4916b4b6c3e4de1c4ba0d998f76d2..5c60a206611bd9f97cfc02afb2e87db523519c9d 100644 GIT binary patch delta 375 zcmexl_{@kepO=@50SNZZo0?ZrtjTnXJvl$G1jsJ31X@|eom;6}P?VpQ znp{#m`H8TP^ev$P2sa3!t%w<@6lk7}$TYQdATvrB$;^1Dc~RU*f|DPqC+O8$-JV9q97S&4n`KBJO?9F0|yh!^`e~3=At}|0=Yn)MJXTx$YG^G)d$?PIrj7(a5i~wYXJ%9iJ diff --git a/osinaweb/osinacore/views.py b/osinaweb/osinacore/views.py index e7581e2d..37723c6a 100644 --- a/osinaweb/osinacore/views.py +++ b/osinaweb/osinacore/views.py @@ -246,28 +246,26 @@ def save_note(request): return render(request, 'addnote-modal.html') - @login_required def save_project(request): if request.method == 'POST': name = request.POST.get('name') customer_username = request.POST.get('customer') manager_username = request.POST.get('manager') - project_type = request.POST.getlist('project_type') # Use getlist for multi-select fields + project_type = request.POST.getlist('project_type') details = request.POST.get('details') - members_usernames = request.POST.getlist('members') # Use getlist for multi-select fields + members_usernames = request.POST.getlist('members') status = request.POST.get('status') start_date = request.POST.get('start_date') end_date = request.POST.get('end_date') - # Fetch the associated profiles try: customer_profile = CustomerProfile.objects.get(user__username=customer_username) manager_profile = StaffProfile.objects.get(user__username=manager_username) members_profiles = StaffProfile.objects.filter(user__username__in=members_usernames) except (CustomerProfile.DoesNotExist, StaffProfile.DoesNotExist): - - pass + # Handle the case where customer_profile or manager_profile is not found + pass # Create and save the project project = Project( @@ -281,13 +279,18 @@ def save_project(request): ) project.save() - project.project_type.set(project_type) project.members.set(members_profiles) + # Save project requirements + requirements = request.POST.getlist('requirements') # Assuming 'requirements' is the name of your requirement input field + for requirement_content in requirements: + if requirement_content: + requirement = ProjectRequirement(content=requirement_content, project=project) + requirement.save() + return redirect('my-projects') - return render(request, 'createproject.html') @login_required diff --git a/osinaweb/templates/create-project.html b/osinaweb/templates/create-project.html index da835ec3..cd7218de 100644 --- a/osinaweb/templates/create-project.html +++ b/osinaweb/templates/create-project.html @@ -62,15 +62,15 @@
- +