From c46b126d1b8c710ac04e492d2eeca6c364860d96 Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Tue, 25 Sep 2018 18:17:35 +0200 Subject: [PATCH 1/6] Remove errant Python cache files --- .../__pycache__/__init__.cpython-36.pyc | Bin 167 -> 0 bytes .../__pycache__/settings.cpython-36.pyc | Bin 2744 -> 0 bytes .../RateMyCourse/__pycache__/urls.cpython-36.pyc | Bin 1085 -> 0 bytes .../RateMyCourse/__pycache__/wsgi.cpython-36.pyc | Bin 580 -> 0 bytes .../postings/__pycache__/__init__.cpython-36.pyc | Bin 163 -> 0 bytes .../postings/__pycache__/admin.cpython-36.pyc | Bin 286 -> 0 bytes backend/postings/__pycache__/apps.cpython-36.pyc | Bin 388 -> 0 bytes .../postings/__pycache__/models.cpython-36.pyc | Bin 562 -> 0 bytes .../api/__pycache__/__init__.cpython-36.pyc | Bin 167 -> 0 bytes .../api/__pycache__/serializers.cpython-36.pyc | Bin 763 -> 0 bytes .../postings/api/__pycache__/urls.cpython-36.pyc | Bin 397 -> 0 bytes .../api/__pycache__/views.cpython-36.pyc | Bin 1457 -> 0 bytes .../__pycache__/0001_initial.cpython-36.pyc | Bin 792 -> 0 bytes .../0002_auto_20180916_1536.cpython-36.pyc | Bin 623 -> 0 bytes .../0003_universityreview_title.cpython-36.pyc | Bin 668 -> 0 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 174 -> 0 bytes 16 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 backend/RateMyCourse/__pycache__/__init__.cpython-36.pyc delete mode 100644 backend/RateMyCourse/__pycache__/settings.cpython-36.pyc delete mode 100644 backend/RateMyCourse/__pycache__/urls.cpython-36.pyc delete mode 100644 backend/RateMyCourse/__pycache__/wsgi.cpython-36.pyc delete mode 100644 backend/postings/__pycache__/__init__.cpython-36.pyc delete mode 100644 backend/postings/__pycache__/admin.cpython-36.pyc delete mode 100644 backend/postings/__pycache__/apps.cpython-36.pyc delete mode 100644 backend/postings/__pycache__/models.cpython-36.pyc delete mode 100644 backend/postings/api/__pycache__/__init__.cpython-36.pyc delete mode 100644 backend/postings/api/__pycache__/serializers.cpython-36.pyc delete mode 100644 backend/postings/api/__pycache__/urls.cpython-36.pyc delete mode 100644 backend/postings/api/__pycache__/views.cpython-36.pyc delete mode 100644 backend/postings/migrations/__pycache__/0001_initial.cpython-36.pyc delete mode 100644 backend/postings/migrations/__pycache__/0002_auto_20180916_1536.cpython-36.pyc delete mode 100644 backend/postings/migrations/__pycache__/0003_universityreview_title.cpython-36.pyc delete mode 100644 backend/postings/migrations/__pycache__/__init__.cpython-36.pyc diff --git a/backend/RateMyCourse/__pycache__/__init__.cpython-36.pyc b/backend/RateMyCourse/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index a57441012a2a1fd05207c0a4b971dd300ff6bd38..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167 zcmXr!<>fkCusE6l2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUm?y`F`>n&Ma41c zMTyzPG5&d}E=8GTsWC38#n~nK1u@S4E}nkwF+qtXslJuY`K3k0sWC~3$=RuSDX4<+ e@tJvXiEdnv<9H|0Nk&!y&wPvrm!3jNJ&goC(~jx0Xa=QF8fDNd%Az@R z3C*`>^(X*>1b_@yVHoAkB&|P$|Es!|6|4C@a^?CF_ zUjVC4L$pm(66Hv zeGy6e4e)dm?ptu*MtS`XN~p2ib8{^oi)D))({4K=!<-Yl&BT^N#k$FH<+$Lulwq+? zoes9Rl+A8o8&gmrv3V>$Mj>#;L_K1QjGL5?EFX(516Sh6^K)rcdI9K7aNKh!7Ksfp zdL}21Ey6$FClHl%@iRyQXZJbpvsd{%ax5kdV~jJfoL(N=d2pELPM=sTKh8QobkFy( z*mApFu}c^ioz~f|OdCNUOsIHdc3sT=Pb`XCkwAY#cf_jRbLVLFh%Yx+*4y59$1nRU ztGQpFI8R?%12UjZ(>_>!!Vmce*Wn1cN1fF{)6(=g%b{!^n+Q{;XZj8cOYSWWw<%eU z%_(V0VM)E~(^8l3dv~XV0R-EeANMiyZcQl}W(L?4l93{KbtsFVa_57!4#=2f!ccr_G@DwSGX9Xqs1}^psrMWnO;disN3t3k;Q--~-!e%pj>4 zl2se2nSL#7oDbXpZds5S6vBHl?c}_TgmBYsd&?KFr1%hc#=WN_+tcO_iuxJPL9xB{ zDdW>Zeg-hs`{gXr)?J_3ls9Y{1$?GW&g~c6gM2 z8sV1dcKInGQ1h&W?66BXUiY#f96jd}eoCosm8yy_ROO07(=Zgg?Wyd;{^^^H0e_GI zgNL9noYY{L$~@q@%dtv&q-zE=dOx&qsQ2cgo+`v9J-1iJcAM{?;eWU&e#okwQI2O0 z-d@x})$L(QtaBbtmM6!D)W@_(hVw`&u?UqgI(a>5Yjg%&3W|3|Ht9#TR^7!-&4IR# zfPoq(>yzkdrDf!6*Vv|%!0O+s=BeW|Ey%8jyS>?rk0NmZe>j6zvfRYlbwjCFED z+g7StsUQcfH`aSI*j{m&o@{6ZFO!GgOPC}1T%2a0b8<--ipF+L)l`3>R8=()fdH7I`q@gUSS%~Ma$WH+)oV4)Xw=JvT6NQ()s)IkS=JQQ zzp|@tl>+WY3=*!@Tt7ETJ=+b zOw(b*8kD*aB>j7gJ`8FYEGJsw)n33fw%4ZS0o$wDxJbzn-Ya5u051@G5TsPy+KY~c zz0u&D6pmjrr2es=dEIl6+r@8!b7C!6ghVEJFD)d6gpf+aC$E$+`8^R&C553ZG1e@A Z(GatF{R5*zq%r^i diff --git a/backend/RateMyCourse/__pycache__/urls.cpython-36.pyc b/backend/RateMyCourse/__pycache__/urls.cpython-36.pyc deleted file mode 100644 index 1caf0968694a1450aca74cddabc8650225a88d7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1085 zcma)5&2G~`5VjrXr*2w=!~^Utwba^BZc#y?l+sGjqCzhw!rgc$iBqrF+Fch~iBr!! z1t%Vc7x0x6uh0{-ZXy{Zq+0T5J)ZsM`@Y?Iy0PK?EWUsI+On))R^#d7`USq~5CgL! zi`mS{Z0=x$d{zND5Rz~qfu#9VNM1vbA_I!p3Sj6FeCApgY8Zx0Br0GFn$JWb#R3u?B!Y*K zhr7Y!P>Ui>RA`DrY_CG^)fdVUOAWn)GEWSslg|6z2LCt1nTe1;~}{fx8(4|CVoik^Aj!7un^ri9 zt)-bL->bTDjJGh3qs^so^h?WhB5^RRYQ5ox#F@0DYeL)nb5*LLa*a{ddgJo^u;ivG zGU4{!XgEGoAk}y#>4h4f@1*Gy6jxPm Wj|*02@caSds~!f|?%R)AeftkygjUD^ diff --git a/backend/RateMyCourse/__pycache__/wsgi.cpython-36.pyc b/backend/RateMyCourse/__pycache__/wsgi.cpython-36.pyc deleted file mode 100644 index ebe18f9bc5313fc0881c72d61f300af8d0552a1a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 580 zcmY+B!EO^V5Qe?pw22mqH~?o~BbD6>ZWThHY>9$sf=DZ*u+qj|Pc}}xwq-jh>9tRS zIQ3!r0xNEu`U;$I5+N;?Jho>%^M4+{K01o-_0MlV0)&2}#t8lXouBr^8-^x`1q_Q| z68JR~xC$p>fFM}376+`w4sNkOg|}#O$nY3-4{v@&U&s9cDU_V?lFXDLU#NrgO;4?i z1)_~wK;hyj8aM*qwX$G|n*-TrQ6cD+075OHq*81p;H7{y2(qSz??RGRz{qq;wHCaf zjw?Bx`g$L{RHY0MF1>2C3lJrJac;?s3pgegAeuX;?P-!QRoIvNdzVH%iu#Ph>EoE8*%# z4cR+nB7bpb{(SD8W|tO>%}PU;HXBJu4PQf+f?YbLv)(B6XjzjeyQ0MsB>UgFC5ZK= W?!4Lm!`qG*v0Kx^9sC$S!G8gm$hs;3 diff --git a/backend/postings/__pycache__/__init__.cpython-36.pyc b/backend/postings/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 0e233cfdfb43af07eeaef5698628771f1dc9f185..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 163 zcmXr!<>fkCusE6l2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUjfcmF`>n&Ma41c zMTyzPG5&d}E=8GTsWC38#n~nK1u@S4E}nkwF+qtXslJuY`K3k0sWC~3$=RuSDKQ24 m#U+_}>BTYe@tJv$&$05CK(+QAv>kd^iSRFv^s%B<%TVs6uhppNqH@6p(`^#811au+mJX; zIwPS)8wU~l1sGEcl|l#hli1YT7y4P{OTI&YlUG(W$Tu1a>qB?}*f`Vkd{aEFANf`| pSPi*3S_HlqhX%Cdy+NmRh5Yj6ydTE&&Icb`xDOv=NS{Vi_6z=^Pgwu} diff --git a/backend/postings/__pycache__/apps.cpython-36.pyc b/backend/postings/__pycache__/apps.cpython-36.pyc deleted file mode 100644 index bb1238b210478ad403a7c8bc37f3560b1b6bb717..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 388 zcmY*Vy-ve05I)C2N=u7)1lA06VM7QNB~rye%8yurC1YU|h33cD2~ubJ9PGSORwiBn z7S3r4;-vfTJAZel^Bs-H!|%hlyL$lmK>sx#*%aL#AV`p;fRdzyzzn1(=?WxOC`NS#+NjEstI;yM3JbQ32TO&xO=yo4LK}sZGCrPRFu$y*!m$hy3Dzod}G|-zo z3H>hMyb`72yc=>}*0L=eA94QNiejVqF1~{aaDES8SJ5%MwaQqQ8L_ZzUa8pRFN(#= zE}B}iXda&@Gj=T+b+L@<)>!pF+3vuE)^?(ohT?E{7waJeq|X!Fepfz;Dyt{1&N!`C W{&rcj0SaAkvi`uSyGTE0M1KJ68(|gz diff --git a/backend/postings/__pycache__/models.cpython-36.pyc b/backend/postings/__pycache__/models.cpython-36.pyc deleted file mode 100644 index 4631b3f29a58c9805bb43219a19969c1ea771242..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 562 zcmYjPO-}1D5Vn&R(!3Tp0%F$<8+HgiA+-Xrph)~I2$rn0GiuW&POu%`D_hud3Rc{N z4Hxj16<1)zBoRfkCusE6l2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUm?y`F`>n&Ma41c zMTyzPG5&d}E=8GTsWC38#n~nK1u@S4E}nkwF+qtXslJuY`K3k0sWC~3$=RuSDKQ24 q#U+_}>BTXL1(`AN@tJv!Jb|S!orxq{B=1fdf%k;B9xMr1=cO z4VF!9p|*>3;1b>^aqjjwuNu)QK!3>j*RD`Ln{(|2aS?8Ua`CkUC5$`NPzc`CYRxy1 zN1|WgxgLIfoW9F1vAoGwx+qP4R>MrA-EGO(elfEualKwA}+Ay}z{Hv z8*62+oXEwsEnt%)RJV%{-IExhT0ZnJG)4BFk>&9MrV{R=~uy zYfFbnLDVo|D5xF2VQG-{N)bz8X~kx8rCqh7G!<2VNaY6-j_%R$JsV!pg#;mKAXp^n zGzCwDTc94usK|0UoOj+X#^@qYVkd);i)v3LFS2z1f#>*H6 OdLdG8x`U7H4*mrOy>c}G diff --git a/backend/postings/api/__pycache__/views.cpython-36.pyc b/backend/postings/api/__pycache__/views.cpython-36.pyc deleted file mode 100644 index f7b96d3ad79f0c4d8e994e333ead3a33ba909ebd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1457 zcmZ`(PjA~c6z8L4N&b`6O;-%qy2F57e92|EVJNyfMNnXI)^yo{6QC&~ZAg|ShoqCb za8K?v{RqA6v=6f{!0S%^3OnsR#qQi-lfWnH@sWJ*_xq9G?(KE{od5pojmOwuZ0BiV z{|Pqp8yd+Zlxzk9W?XQfe_nbsU-;Pfq+hmXfe0FZs|;t6h=3h48OZQ0lc9p5z4k;0 zJ&|mqr>%I=MQ?BIi#^$S$p+mIxC9beu%VE9HM#UFtHdU33 z=e4nUH8F8I&tt;F9L|@nH&HgZTqwOX%62I=s+hs+uMnkAiaFek91TJjB}tXeRFb$( zlFVwkD5>8|aJjVHjP%O7o-XFeI9H|A0j})&SilDEBr8*6^gVPp1@4%A@%`L$ZZTg)%_2!yTr6_~|(@rQ109BUK*$kdhm!o?>T9)f-r`!Yllu zC1DM3_=-z5ZR^J?C;}VeAHRX->)pUpwuT~FGn@mssXuaXIRMeOxh0_TtgdX@NL3tA zUsZP3+ivurNhq3laiLbold;Y_e)hBTkPR1%^U^A<2_qNDoCwY=N~uQEB>CZymwSGsv2C7 zX@zne_)Sv!a}0HUswa3J|64=jae6 zuS#=!Y`g!8+H7Pli?o{5hw@?@NGyp*XUghaU8(cAL|E|PT3s))Ld&1f lZ6>-uBDLEXN^z%{rZ%d`Mc>~Z!pC&WG&f8idh~h+!9UD2Vi*7b diff --git a/backend/postings/migrations/__pycache__/0001_initial.cpython-36.pyc b/backend/postings/migrations/__pycache__/0001_initial.cpython-36.pyc deleted file mode 100644 index 9cf0b28c4ef1f4bc165f36ec05f744e2a7c1d6d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 792 zcmY*X&2H2%5VoD{PqMqEAdVn$LfT7J#0{aUXjiRzXe*WW5+YgIooVXb#0hp%*k0k< zr{Kh!aNz}fMI8DHoS0-=T4H%LpT{%#<{Q5rjl!Shw-3JsW53vg&nJJEwtYzk81Rhc zJmR^C1ZVpU1bAN=c*qyt7ccU_f6vC98@kKJ!iBj?O;V{sTi4ACz|78@(A^i3vrF5S zWROK1SR{Z)UdkdLJBw~p9(#*Ea9TcepnL6~3+T~V0DTCqIic`BG$0hh5Jqim<6$iA zz@uxC@@N2?MDwu=4)6G#y3I4KF40(3txoV#;U^~)>^X5T9s6#W)Kwwp29pZG4N9Z( z#H{2JS1zzW{8%Sh zbD2<2X;l$XHv}wE1M0a#YiQog4JK`8hs}hH*PI0JsNucl2QHXgBxdc7rbP8r<+z4n zQR3}*zccfU@>=spPTs_4)Sr!M`b!%hYn&PqH=d$hRz(?4j;9Al`|$}?J6uhQ+E|Qd z$$Uw); zp2sd3_z*lY2+&*k4?*Tb_?abxKXi^Io{cxM(0L;(WtJ|qA438cw9J$YvdjZUSL4FV z0t{CJ2q1(348QNaBZ!<=_}LIfRN&Z-uJ+6}sw>k-RTw)?({v)Fl8wwu`?OW^4z-cZ zR^y$-dmB+isCqGL?vKnfGEp!LL(iu<^!vTbFG#Zyta4RUr*PXf(!~!? U?$HaPu+jTojSr65xTeR!Kd=U@i2wiq diff --git a/backend/postings/migrations/__pycache__/0003_universityreview_title.cpython-36.pyc b/backend/postings/migrations/__pycache__/0003_universityreview_title.cpython-36.pyc deleted file mode 100644 index fb98ec203e36a3575ffe20282fa7f3ddec1340a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmZ8fO>fgc5M6)8AEZ)lA=jem37e{jwPQ&Hgzq#m98jGXh{>6|A%p ztF#l_Vy6sjaK18d&{{cPoWue50~>pH^e!9QIx6!_iZ-t+r3YmVSg55b?T$~uF)=fG)pTAq2rtd|IXWLobNrmZ!SgvVuy0b8S{A?+iIpzNw z$9vxnnyoayhta5p1c5VfUCX9tX!Vr^nHIuIR9Srh7rmxlNnd>2`aXI}3_5sy@6H<| JSQ!&W&RfkCusE6l2p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CU(wE1F`>n&Ma41c zMTyzPG5&d}E=8GTsWC38#n~nK1u@S4E}nkwF+qtXslJuY`K3k0sWC~3$=RuSDKQ24 w#U+_}>BTX*nLynonfZCeG4b)4d6^~g@p=W7w>WHa^HWN5Qtd#N76UN@0Q9ync>n+a -- 2.34.1 From d48e1547ad078a934f969f6e9aacebace4d0d81e Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Tue, 25 Sep 2018 18:31:48 +0200 Subject: [PATCH 2/6] Add index view --- backend/RateMyCourse/urls.py | 3 +++ backend/RateMyCourse/views.py | 5 +++++ backend/db.sqlite3 | Bin 139264 -> 139264 bytes 3 files changed, 8 insertions(+) create mode 100644 backend/RateMyCourse/views.py diff --git a/backend/RateMyCourse/urls.py b/backend/RateMyCourse/urls.py index 8ac49dc..6dc6b61 100644 --- a/backend/RateMyCourse/urls.py +++ b/backend/RateMyCourse/urls.py @@ -16,7 +16,10 @@ Including another URLconf from django.contrib import admin from django.urls import re_path,path,include +from . import views + urlpatterns = [ + path('', views.index, name='index'), path('admin/', admin.site.urls), re_path(r'^api/postings/', include(('postings.api.urls','postings'), namespace='api-postings')), ] diff --git a/backend/RateMyCourse/views.py b/backend/RateMyCourse/views.py new file mode 100644 index 0000000..ff7e542 --- /dev/null +++ b/backend/RateMyCourse/views.py @@ -0,0 +1,5 @@ +from django.http import HttpResponse + + +def index(request): + return HttpResponse("Hello, world. You're at the index.") diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 index 3e92540cb4653d9f3e77ea3a021b81d887f0caa7..dd149749b5ff21502b348ff3073e7b7f4192e4f4 100644 GIT binary patch delta 1304 zcmZvcU2NM_6vusHJBjPqCyiLsHlcCGMwg{&Y$s`(tS~~=2Ra516XHW^(~yQXTfUaG zg$k(+n&=Y`ZS!CdVnSmY0|sJPY7hghnn0Qm+R!us8iz%aK&RG?^_{4ETXI?tr1$eGpJT@2R^rg&#-+#Uw{!Dec$GsWC& zwo=Va&sDO9(xwlNoj*M2#Zd}x;Z3}Oui~G04X@%1Y4b8(z!ILvbND6ZaFw+DA!hJ6 z9wn`h;tIZji&!K3_85{*}3{IFcR(M=QZ0J z1VzWFqu(L$fAJUjWBk04%P(yAvJ~tL-9yPxx+odnOWLF+=pmj^|9`M)`ZiIL43@l| z#O&+df~n~;$m;4KtNuU}t%aF#bKN9uS35BTBln}$G;Pth!_87$w{j1DO&j4+GXK?B z8>!cy+#vFPAcxYv%}%#gqzzW%+eqG?;d*kcy`g^x`)TK0U(QSB9=&z^I@WKO*amYI zZuwTfhhIcn5{H7oaT=~eC&aWf>(HV7^DDR>PSPAj76sto&M~3%8OMYYO~mBhn4+li zK-5gw9Szv%q~(A8u|#wrArJH_vKo)}sir@m693a+`i+O*T|bsk;|Vp|8&M*v64ky~ Khn^Eoi}PRDWoM-T delta 846 zcmZ8fT}V@57(VYg`#Ia(dADlLn(3B?uDR`;wJkRnwbqad6Z(OQYVOB=(ArW5K~#%i z5O|@T;QgVu-jC-iP=73S)d> zjPJ9VV+_MAqi|3FMRR|{N_C8JPu;(hxrF>8Bh8r&imWx&C=UA>gQD1Ws0@8LgpctA zCUCXl5bIE0?bVXwX|SrWm#L8xULUaXS#K09@`Tp~<`Ge4_gI7ogOm6HpW$sBzyjuQ z4{pRJbfOhO_$Is&9tp#OEF2Yf2@%>&FDQ|{FOGODSY+@QPUBDfj$iRJm6*VBe1T7J z6z@^7TX+L6Q^~W~i$%rUwhfiyrxR@}j9iYvTH&ps-tbWOPV1+p~YA*T+~nMckBB2=h`cpSDISYQB|Dl z9T?Lh$vy`19+A(m^MWxELA&Z(i zj?2-#6(!|0v~YLXj{=V|oeOl)0BJ>bF|i`MV7X6}8r@>ZEd}jTFf0YaqUZ^V{*Ygc zaykZMV59|PGqRO+oc2GmKO7J}0ZHs2|-S+(9gZtaF MUC9n<$i$ld0L!f1y8r+H -- 2.34.1 From 15f259f0ee746f6433386c76fda930ee1131398c Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Tue, 25 Sep 2018 22:52:38 +0200 Subject: [PATCH 3/6] Went on a coding binge and added api support for all new model objects. --- backend/RateMyCourse/urls.py | 3 + backend/db.sqlite3 | Bin 139264 -> 212992 bytes backend/postings/admin.py | 10 ++- backend/postings/api/serializers.py | 60 ++++++++++++- backend/postings/api/urls.py | 24 +++++- backend/postings/api/views.py | 44 +++++++++- .../migrations/0004_auto_20180925_1941.py | 81 ++++++++++++++++++ .../migrations/0005_auto_20180925_2032.py | 18 ++++ backend/postings/models.py | 2 +- 9 files changed, 234 insertions(+), 8 deletions(-) create mode 100644 backend/postings/migrations/0004_auto_20180925_1941.py create mode 100644 backend/postings/migrations/0005_auto_20180925_2032.py diff --git a/backend/RateMyCourse/urls.py b/backend/RateMyCourse/urls.py index 6dc6b61..e6da862 100644 --- a/backend/RateMyCourse/urls.py +++ b/backend/RateMyCourse/urls.py @@ -19,7 +19,10 @@ from django.urls import re_path,path,include from . import views urlpatterns = [ + # / Shows the main index page of the website. path('', views.index, name='index'), + # /universities/1/ Shows the page for a university. + # TODO: add pages for each rateable entity. path('admin/', admin.site.urls), re_path(r'^api/postings/', include(('postings.api.urls','postings'), namespace='api-postings')), ] diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 index dd149749b5ff21502b348ff3073e7b7f4192e4f4..f7ec70412271c104bf80fb3b6a26a472837ef078 100644 GIT binary patch delta 8520 zcmb_h4QyN2b$*xcQT*rCuW84X^hC*$Xi6dSd?`A5oJmK2{PN}@=U zlr1^P7|M1r><5U$wc3UP>DnRd)(%-Gph}Po4c2AA5~SI>64@ZuoV;FM{9sTYY>>nCgG; z88v)T;rD@3HvAEO|J&Jh+yEaeM}V|+n1D9x-zjM7_c4ZE{X3gn{WJR9L(OWc^&2KT-j-SHc#d#dYkK?=eC`RVD%x`UW zu-`T3tj+W(T?uA5l}^qInM^VrURjP`5z?7>HZEjZo9JL!W+u6k&Io1E4E`ZyfJq=f zEr@oY*g|A^E*Vb5=hBgEJh_}{-rGPQM6wg$3X$lNAS`F&bass?gdOdTplmYG?Fc4m zKD?3<(yGGajuyAx!q9xl;!JWm3rgYaT1qfAscE|;of6WCcqRj$$O2N9Tfru8V?Avz zLrx1<;=)xu@nQZEh2O<5<2UeM;;)*2WWI+da2irZ7~9`y~LBz zHX4+o60%l3@Ej%4ZD@DtV7Q|+Eboc62eiPq0l!Jy-pUott`(NXevft=)(e{PfYVek zT{S&y3Yz*%&Bl+7|7Lv2_)X()84V9h2(BxP!BT2ge4&>6nVVFo0*60R^qwp8PtJHkyxxK#5FU>hK!;qc_y5@ z7}Sr9MQbwKA+cxXbD~9=KOj0X5~DJ&Uxa87?Ml2_*o8P*0(WO592l1INy!#?K`trn~r4=jW#VlT#_-`54%qsO)s9FOrHxlP7V4ldlwH?+UElYT&@APhxd3~ zg@1msQ>(%d?_K=CX2Tcm;1)f-2T8D0TH2z6)Vr85ZKBjC?N6i_+HHQNp!vIi6JLOI zcM1>T!;tWJ+>d*32i}WYFvdDeoB!MVf%!f2PtE^ozHNTp{14_=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Cbl6=-PO8f>}#i QhZyPEB-_@g33?sFpu1trUUxEeJg@qvgjgqSc8gY3ykM%8HcFq8RpQL~eCPV)V} z-}%1tuToJe7aY@mPah#<8?*bE0kgd`+uOW-WXI;)_8Nk#%o883DuMa(6ncXD6NiEf z@%k0!>*P@?x*s&}4?ZfJqyE$U=2JvKo!}C_k6+;=>Nt(lrsv2*DB>v+lZu6zn4jt` zfjXDW1*GBe@~A#uN{!(Ugs0Oj-dA`Z&$U7F*l<2w&_@dSaw=ce%P$pE;wC#6g7tu6 zYAly2l`@5VeJvB|U-ob^m&xndLfQ*l%YRSgGU>75GNYF2oQy1Dj^JIqj5qL0dp6j#PR1JA1J-tcWk846MZI?>E9DRFwt=$ z{Zwo`9xom3O`K@eUWk?ty|`~+cWXG((Hz#ABhg?ayfdQhd|2C|bwu0RJLv7X2ONMa zgsGGLcL$vg&L^=#kCzk^ife({BG1+15EZXz?0zfKp<5papk5^EMV9cVs$*&w*!R6^ zj~PE#A!z=3*Vo@Ht`N8FJ%SDDRk>0AT)HNFcqCs_6P&cPIGA8v-489Ekn1s` zLXOB2&X1+n9PO!4jw+0+)<&qAtbtaaH$ z;U+<*47h^E%_=mqs&p%?M B7%Tt) diff --git a/backend/postings/admin.py b/backend/postings/admin.py index 05a8ce7..5961a97 100644 --- a/backend/postings/admin.py +++ b/backend/postings/admin.py @@ -1,6 +1,12 @@ from django.contrib import admin -from .models import UniversityReview +from .models import * # Register your models here. -admin.site.register(UniversityReview) \ No newline at end of file +admin.site.register(UniversityReview) +admin.site.register(Review) +admin.site.register(RateableEntity) +admin.site.register(ReviewHelpfulVote) +admin.site.register(University) +admin.site.register(Professor) +admin.site.register(Course) \ No newline at end of file diff --git a/backend/postings/api/serializers.py b/backend/postings/api/serializers.py index c129084..433639f 100644 --- a/backend/postings/api/serializers.py +++ b/backend/postings/api/serializers.py @@ -1,5 +1,5 @@ from rest_framework import serializers -from postings.models import UniversityReview +from postings.models import * class UniversityReviewSerializer(serializers.ModelSerializer): @@ -16,4 +16,62 @@ class UniversityReviewSerializer(serializers.ModelSerializer): read_only_fields =[ 'pk', 'username' + ] + +# Serializes the generic Review object. +class ReviewSerializer(serializers.ModelSerializer): + class Meta: + model = Review + fields = [ + 'pk', + 'rating', + 'title', + 'content', + 'rateable_entity', + 'created_date', + 'last_updated_date' + ] + read_only_fields = [ + 'pk', + 'created_date', + 'rateable_entity' + ] + +# Serializes Universities. +class UniversitySerializer(serializers.ModelSerializer): + class Meta: + model = University + fields = [ + 'pk', + 'name' + ] + read_only_fields = [ + 'pk' + ] + +# Serializes Courses. +class CourseSerializer(serializers.ModelSerializer): + class Meta: + model = Course + fields = [ + 'pk', + 'name', + 'taught_at_university', + 'professors' + ] + read_only_fields = [ + 'pk' + ] + +# Serializes Professors. +class ProfessorSerializer(serializers.ModelSerializer): + class Meta: + model = Professor + fields = [ + 'pk', + 'name', + 'universities' + ] + read_only_fields = [ + 'pk' ] \ No newline at end of file diff --git a/backend/postings/api/urls.py b/backend/postings/api/urls.py index d310315..1b6e317 100644 --- a/backend/postings/api/urls.py +++ b/backend/postings/api/urls.py @@ -1,11 +1,31 @@ -from .views import UniReviewRudView,UniReviewAPIView -from django.urls import re_path +from .views import * +from django.urls import path, re_path urlpatterns = [ + # /api/postings/reviews/ Lists all review objects. + path('reviews/', ReviewsView.as_view(), name='reviews'), + # /api/postings/reviews/1/ Returns data for one Review. + path('reviews/', ReviewView.as_view(), name='review'), + # /api/postings/universities/ Lists all university objects. + path('universities/', UniversitiesView.as_view(), name='universities'), + # /api/postings/universities/1/ Returns data for one University. + path('universities/', UniversityView.as_view(), name='university'), + + # /api/postings/courses/ Lists all course objects. + path('courses/', CoursesView.as_view(), name='courses'), + # /api/postings/courses/1/ Returns data for one Course. + path('courses/', CourseView.as_view(), name='course'), + + # /api/postings/professors/ Lists all professor objects. + path('professors/', ProfessorsView.as_view(), name='professors'), + # /api/postings/professors/1/ Returns data for one Professor. + path('professors/', ProfessorView.as_view(), name='professor'), + + # Deprecated re_path(r'^(?P\d+)/$', UniReviewRudView.as_view(), name='post-rud'), re_path(r'^$', UniReviewAPIView.as_view(), name='post-create') ] \ No newline at end of file diff --git a/backend/postings/api/views.py b/backend/postings/api/views.py index 8f22d4e..70cf3d6 100644 --- a/backend/postings/api/views.py +++ b/backend/postings/api/views.py @@ -1,6 +1,6 @@ from rest_framework import generics, mixins -from postings.models import UniversityReview -from .serializers import UniversityReviewSerializer +from postings.models import UniversityReview, Review +from .serializers import * from django.db.models import Q @@ -26,3 +26,43 @@ class UniReviewAPIView(mixins.CreateModelMixin, generics.ListAPIView): def post(self,request,*args,**kwargs): return self.create(request, *args, **kwargs) + +# The view for listing all generic Review objects. +class ReviewsView(mixins.CreateModelMixin, generics.ListAPIView): + queryset = Review.objects.all() + serializer_class = ReviewSerializer + +# View for an individual Review object. +class ReviewView(generics.RetrieveUpdateDestroyAPIView): + queryset = Review.objects.all() + serializer_class = ReviewSerializer + +# The view for listing all Universities. +class UniversitiesView(generics.ListAPIView): + serializer_class = UniversitySerializer + queryset = University.objects.all() + +# The view for an individual University. +class UniversityView(generics.RetrieveUpdateDestroyAPIView): + queryset = University.objects.all() + serializer_class = UniversitySerializer + +# The view for listing all Courses. +class CoursesView(generics.ListAPIView): + serializer_class = CourseSerializer + queryset = Course.objects.all() + +# The view for an individual Course. +class CourseView(generics.RetrieveUpdateDestroyAPIView): + queryset = Course.objects.all() + serializer_class = CourseSerializer + +# The view for listing all Professors. +class ProfessorsView(generics.ListAPIView): + queryset = Professor.objects.all() + serializer_class = ProfessorSerializer + +# The view for an individual Professor. +class ProfessorView(generics.RetrieveUpdateDestroyAPIView): + queryset = Professor.objects.all() + serializer_class = ProfessorSerializer \ No newline at end of file diff --git a/backend/postings/migrations/0004_auto_20180925_1941.py b/backend/postings/migrations/0004_auto_20180925_1941.py new file mode 100644 index 0000000..a3a0581 --- /dev/null +++ b/backend/postings/migrations/0004_auto_20180925_1941.py @@ -0,0 +1,81 @@ +# Generated by Django 2.1.1 on 2018-09-25 19:41 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('postings', '0003_universityreview_title'), + ] + + operations = [ + migrations.CreateModel( + name='RateableEntity', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=256)), + ], + ), + migrations.CreateModel( + name='Review', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('rating', models.IntegerField(default=1)), + ('title', models.CharField(max_length=128)), + ('content', models.TextField()), + ('created_date', models.DateTimeField(auto_now_add=True)), + ('last_updated_date', models.DateTimeField(auto_now=True)), + ], + ), + migrations.CreateModel( + name='ReviewHelpfulVote', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('helpful', models.BooleanField()), + ('review', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.Review')), + ], + ), + migrations.CreateModel( + name='Course', + fields=[ + ('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')), + ], + bases=('postings.rateableentity',), + ), + migrations.CreateModel( + name='Professor', + fields=[ + ('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')), + ], + bases=('postings.rateableentity',), + ), + migrations.CreateModel( + name='University', + fields=[ + ('rateableentity_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='postings.RateableEntity')), + ], + bases=('postings.rateableentity',), + ), + migrations.AddField( + model_name='review', + name='rateable_entity', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.RateableEntity'), + ), + migrations.AddField( + model_name='professor', + name='university', + field=models.ManyToManyField(to='postings.University'), + ), + migrations.AddField( + model_name='course', + name='professors', + field=models.ManyToManyField(to='postings.Professor'), + ), + migrations.AddField( + model_name='course', + name='taught_at_university', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='postings.University'), + ), + ] diff --git a/backend/postings/migrations/0005_auto_20180925_2032.py b/backend/postings/migrations/0005_auto_20180925_2032.py new file mode 100644 index 0000000..94e10b8 --- /dev/null +++ b/backend/postings/migrations/0005_auto_20180925_2032.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.1 on 2018-09-25 20:32 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('postings', '0004_auto_20180925_1941'), + ] + + operations = [ + migrations.RenameField( + model_name='professor', + old_name='university', + new_name='universities', + ), + ] diff --git a/backend/postings/models.py b/backend/postings/models.py index bc1038a..1896970 100644 --- a/backend/postings/models.py +++ b/backend/postings/models.py @@ -35,7 +35,7 @@ class University(RateableEntity): # A RateableEntity for professors, who belong to one or more university. class Professor(RateableEntity): # The universities that this professor teaches or has taught at. - university = models.ManyToManyField('postings.University') + universities = models.ManyToManyField('postings.University') # A RateableEntity for courses, which belong to a university, and have one or more professors. class Course(RateableEntity): -- 2.34.1 From 03ca23d5c97480c657a831e3562b6ca25f38c9e3 Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Wed, 26 Sep 2018 23:24:44 +0200 Subject: [PATCH 4/6] Remove index view --- backend/RateMyCourse/urls.py | 3 --- backend/RateMyCourse/views.py | 5 ----- 2 files changed, 8 deletions(-) delete mode 100644 backend/RateMyCourse/views.py diff --git a/backend/RateMyCourse/urls.py b/backend/RateMyCourse/urls.py index 6dc6b61..8ac49dc 100644 --- a/backend/RateMyCourse/urls.py +++ b/backend/RateMyCourse/urls.py @@ -16,10 +16,7 @@ Including another URLconf from django.contrib import admin from django.urls import re_path,path,include -from . import views - urlpatterns = [ - path('', views.index, name='index'), path('admin/', admin.site.urls), re_path(r'^api/postings/', include(('postings.api.urls','postings'), namespace='api-postings')), ] diff --git a/backend/RateMyCourse/views.py b/backend/RateMyCourse/views.py deleted file mode 100644 index ff7e542..0000000 --- a/backend/RateMyCourse/views.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.http import HttpResponse - - -def index(request): - return HttpResponse("Hello, world. You're at the index.") -- 2.34.1 From be143d2afd427340c306cbaa8dbdca6c13ac488a Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Wed, 26 Sep 2018 23:25:14 +0200 Subject: [PATCH 5/6] Serve static files at /static/ --- backend/RateMyCourse/settings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/RateMyCourse/settings.py b/backend/RateMyCourse/settings.py index 73873c8..4a8b0ad 100644 --- a/backend/RateMyCourse/settings.py +++ b/backend/RateMyCourse/settings.py @@ -134,3 +134,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' + +STATICFILES_DIRS = [ + os.path.join(BASE_DIR, '../frontpage'), +] \ No newline at end of file -- 2.34.1 From fbacc83527daa56132461471d9093f1993086973 Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Wed, 26 Sep 2018 23:52:28 +0200 Subject: [PATCH 6/6] Serve index2.html and static files from / --- backend/RateMyCourse/urls.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/RateMyCourse/urls.py b/backend/RateMyCourse/urls.py index 5417131..a3f6829 100644 --- a/backend/RateMyCourse/urls.py +++ b/backend/RateMyCourse/urls.py @@ -15,8 +15,19 @@ Including another URLconf """ from django.contrib import admin from django.urls import re_path,path,include +from django.conf.urls import url +from django.contrib.staticfiles.views import serve +from django.views.generic import RedirectView urlpatterns = [ + # / routes to index2.html + url(r'^$', serve, kwargs={'path': 'index2.html'}), + + # static files (*.css, *.js, *.jpg etc.) served on / + # (assuming Django uses /static/ and /media/ for static/media urls) + url(r'^(?!/?static/)(?!/?media/)(?P.*\..*)$', + RedirectView.as_view(url='/static/%(path)s', permanent=False)), + # /universities/1/ Shows the page for a university. # TODO: add pages for each rateable entity. path('admin/', admin.site.urls), -- 2.34.1