From 2fd5f08ca6edd7ec073234a523c1b879c7cb46a5 Mon Sep 17 00:00:00 2001 From: graks Date: Sun, 16 Sep 2018 17:52:23 +0100 Subject: [PATCH] Basic CRUD for uni reviews --- backend/RateMyCourse/__init__.py | 0 .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 172 bytes .../__pycache__/settings.cpython-36.pyc | Bin 0 -> 2656 bytes .../__pycache__/urls.cpython-36.pyc | Bin 0 -> 1090 bytes .../__pycache__/wsgi.cpython-36.pyc | Bin 0 -> 585 bytes backend/RateMyCourse/settings.py | 132 ++++++++++++++++++ backend/RateMyCourse/urls.py | 22 +++ backend/RateMyCourse/wsgi.py | 16 +++ backend/db.sqlite3 | Bin 0 -> 139264 bytes backend/manage.py | 15 ++ backend/postings/__init__.py | 0 .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 168 bytes .../postings/__pycache__/admin.cpython-36.pyc | Bin 0 -> 291 bytes .../postings/__pycache__/apps.cpython-36.pyc | Bin 0 -> 388 bytes .../__pycache__/models.cpython-36.pyc | Bin 0 -> 567 bytes backend/postings/admin.py | 6 + backend/postings/api/__init__.py | 0 .../api/__pycache__/__init__.cpython-36.pyc | Bin 0 -> 172 bytes .../__pycache__/serializers.cpython-36.pyc | Bin 0 -> 768 bytes .../api/__pycache__/urls.cpython-36.pyc | Bin 0 -> 402 bytes .../api/__pycache__/views.cpython-36.pyc | Bin 0 -> 1462 bytes backend/postings/api/serializers.py | 19 +++ backend/postings/api/urls.py | 11 ++ backend/postings/api/views.py | 28 ++++ backend/postings/apps.py | 5 + backend/postings/migrations/0001_initial.py | 24 ++++ .../migrations/0002_auto_20180916_1536.py | 23 +++ .../migrations/0003_universityreview_title.py | 19 +++ backend/postings/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-36.pyc | Bin 0 -> 797 bytes .../0002_auto_20180916_1536.cpython-36.pyc | Bin 0 -> 628 bytes ...0003_universityreview_title.cpython-36.pyc | Bin 0 -> 673 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 0 -> 179 bytes backend/postings/models.py | 10 ++ backend/postings/tests.py | 3 + backend/postings/views.py | 3 + 36 files changed, 336 insertions(+) create mode 100644 backend/RateMyCourse/__init__.py create mode 100644 backend/RateMyCourse/__pycache__/__init__.cpython-36.pyc create mode 100644 backend/RateMyCourse/__pycache__/settings.cpython-36.pyc create mode 100644 backend/RateMyCourse/__pycache__/urls.cpython-36.pyc create mode 100644 backend/RateMyCourse/__pycache__/wsgi.cpython-36.pyc create mode 100644 backend/RateMyCourse/settings.py create mode 100644 backend/RateMyCourse/urls.py create mode 100644 backend/RateMyCourse/wsgi.py create mode 100644 backend/db.sqlite3 create mode 100644 backend/manage.py create mode 100644 backend/postings/__init__.py create mode 100644 backend/postings/__pycache__/__init__.cpython-36.pyc create mode 100644 backend/postings/__pycache__/admin.cpython-36.pyc create mode 100644 backend/postings/__pycache__/apps.cpython-36.pyc create mode 100644 backend/postings/__pycache__/models.cpython-36.pyc create mode 100644 backend/postings/admin.py create mode 100644 backend/postings/api/__init__.py create mode 100644 backend/postings/api/__pycache__/__init__.cpython-36.pyc create mode 100644 backend/postings/api/__pycache__/serializers.cpython-36.pyc create mode 100644 backend/postings/api/__pycache__/urls.cpython-36.pyc create mode 100644 backend/postings/api/__pycache__/views.cpython-36.pyc create mode 100644 backend/postings/api/serializers.py create mode 100644 backend/postings/api/urls.py create mode 100644 backend/postings/api/views.py create mode 100644 backend/postings/apps.py create mode 100644 backend/postings/migrations/0001_initial.py create mode 100644 backend/postings/migrations/0002_auto_20180916_1536.py create mode 100644 backend/postings/migrations/0003_universityreview_title.py create mode 100644 backend/postings/migrations/__init__.py create mode 100644 backend/postings/migrations/__pycache__/0001_initial.cpython-36.pyc create mode 100644 backend/postings/migrations/__pycache__/0002_auto_20180916_1536.cpython-36.pyc create mode 100644 backend/postings/migrations/__pycache__/0003_universityreview_title.cpython-36.pyc create mode 100644 backend/postings/migrations/__pycache__/__init__.cpython-36.pyc create mode 100644 backend/postings/models.py create mode 100644 backend/postings/tests.py create mode 100644 backend/postings/views.py diff --git a/backend/RateMyCourse/__init__.py b/backend/RateMyCourse/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/RateMyCourse/__pycache__/__init__.cpython-36.pyc b/backend/RateMyCourse/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2816b75c866d992cc8c956e704355487cbdf874 GIT binary patch literal 172 zcmXr!<>fl4HZPh12p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUy;sMF`>n&Ma41c zMTyzPG5&d}E=8GTsWC38#n~nK1u@S4E}nkwF+qtXslJuY`K3k0sdzZ?@tJvPSaT4z&I?2c=k(p2N@Gw)5G}9oNnRd*ag&9ae8Zs~oSvUh{+Zi(p zb1)C*;5=M_i*Tu(HqXF5^+k#XM3a-aEk^9W;kd{!g*$v_lhANPo z2l9Ow0+(#)QAg&&W@2o4U-me2drs3 zdy5am2l3H!1%S8TSspZ7hMDQRd{||FVYD)(*W+ZA2woq_BBx&m;W&3Y)2{J@RpK6#Pr!zE;g1j znum(_SVh_z_F)7#y@*NSqTtG?m=V;|uPmZVTYDY5wTE0#ep?TVTI+{R&m*`CQK~5( z>vBIob|px!-$k}5P4qz=n6N=94vA-s)!e)|?1+!TLY}lRGnaAy!L*apHVTlY*Y+2` z!IF^=$Qj{39NQjsZCKQ=cn*v0uTB{s74j>9i7qDv={2?RMynQ0saUG(K}Ox&w1%^E zZPO^#s=9ysM9l`gO%=P}$7&BBWsnB4V|!h3)alSXE+PNWrGl*bSrm@vxkQlCsvD)M z7D!dKqOmj*+d>CoD-)+Jc8~GDd@FuLm(6jG#|~b7tAnc7BaF6Ac{p4=xi2Vv!g_SH(I_Pzp%Q_^ z7bk74&Oj((@s7!+{HoWgTcl~Y*wzs+QsZ#-BzhV--aV#3EB_8!vpH>@gya(DjiR=$ zHp+&zsnshbUB}k43T0K-HQl^3(WwpNwN^Ds1vPBFiQbY~hS!QNU z)wQtcgRHI<>Y8D_(cT3!MQyFI5zMLOa&1d1TCZ!mp$GG&s&1eN1;`XV$W}_lVp-c# z>soNOUaJ{aqh2o5s_Vh5p;b1^s-fw@`7M2;6xx@^D+{EKOPyf0s2XY*To0~=OSd+$ z9$U3~(R!4vplN2;LeO)yths~Zhzrj%BKRw{H8MoiuK&P=9p9NA8xl~{Gb zieF&QFYqbZvf>xI;yO*F2nke6xw3Dr&pqeZezLLQ{rvj~LM{q2)&eb>!nTS=uRy13PT#6OMI*0`i zAqyV|4?`{TBvzp*4zaxoy;q+pM=Uk=_KGYv>~7muppOFbk}*OvlJHzeJtkx>1topM%O6f>iK$Of78r zWL{f2zP0Q2I09pML$a>ju1vWz+p|@vM*s~ zOfTIk_Umm|y{aI*+WbiKB+P}e`3kliG^wj0=60GDc3Cqgr*ay@q3_5Z zwwC5a`Ci$d&F~h^X3=IX9R1QVIg|J>ta82OhQv2%N!Ns~`RA%cL+Ki$%JtUe`C-XT zQ)I%;$z(h|Q6SZHA?dlA9%ZmAlM9&cf;z_wKAjxx9vr@&w%_1?7N%K{UzUTXT(BaA S=l8IQ8enkkq5YsUwEqAxy;#Qp literal 0 HcmV?d00001 diff --git a/backend/RateMyCourse/__pycache__/wsgi.cpython-36.pyc b/backend/RateMyCourse/__pycache__/wsgi.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..565be6cc37f75bb09b93a50de1beefe834fddd53 GIT binary patch literal 585 zcmaKp!EO^V5Qe?pw22mqH~?p#kRriu1-A;JqHKv$(L^GRkitqEvz~06dhM0%q@>rr zM8MRk5TvV<{|nr?hi+Enp3Ttf}U^kfaqbGMmx5 z7QCRAD><9_dLO-1r8E#Oy=t`!5G8$aZpfSqcts3Aw6L}|CrQFoVPdwVvQ+<=3RNW_ zlQ;2kvQXDnB@AkzHWf&lT$_?7(Qn@qH0%cMSqV1Zp5+Y;_aZ(2Fzk==@!93&VAvn$ z7o&9Y>FnltvjwpMYq=~1Nf-G<26MU+ z);(&-{zN+R7kB2*q<4}{3}};;nqHY~Bq7y&4Ot52%Bni+jZ%-6HHrS?Y%$_`<2vv5 SpYguqmCV+(a0frePw-!pnY+&b literal 0 HcmV?d00001 diff --git a/backend/RateMyCourse/settings.py b/backend/RateMyCourse/settings.py new file mode 100644 index 0000000..03b8eff --- /dev/null +++ b/backend/RateMyCourse/settings.py @@ -0,0 +1,132 @@ +""" +Django settings for RateMyCourse project. + +Generated by 'django-admin startproject' using Django 2.0.6. + +For more information on this file, see +https://docs.djangoproject.com/en/2.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/2.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'ov0vt*b-3gz5y7p-0)^(o+7cwiwrbank*(tqtxuotdduvj0wbc' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'postings', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + 'rest_framework', +] + +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 = 'RateMyCourse.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + '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 = 'RateMyCourse.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/2.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/2.0/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', + }, +] + +REST_FRAMEWORK = { + 'DEFAULT_PERMISSION_CLASSES': ( + 'rest_framework.permissions.IsAuthenticated', + ), + 'DEFAULT_AUTHENTICATION_CLASSES': ( + 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', + 'rest_framework.authentication.SessionAuthentication', + 'rest_framework.authentication.BasicAuthentication', + ), +} + +# Internationalization +# https://docs.djangoproject.com/en/2.0/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/2.0/howto/static-files/ + +STATIC_URL = '/static/' diff --git a/backend/RateMyCourse/urls.py b/backend/RateMyCourse/urls.py new file mode 100644 index 0000000..8ac49dc --- /dev/null +++ b/backend/RateMyCourse/urls.py @@ -0,0 +1,22 @@ +"""RateMyCourse URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/2.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import re_path,path,include + +urlpatterns = [ + path('admin/', admin.site.urls), + re_path(r'^api/postings/', include(('postings.api.urls','postings'), namespace='api-postings')), +] diff --git a/backend/RateMyCourse/wsgi.py b/backend/RateMyCourse/wsgi.py new file mode 100644 index 0000000..da64bec --- /dev/null +++ b/backend/RateMyCourse/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for RateMyCourse project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RateMyCourse.settings") + +application = get_wsgi_application() diff --git a/backend/db.sqlite3 b/backend/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..6908531aa40fb743d4a42466152f2ce067d90344 GIT binary patch literal 139264 zcmeI5Yit|Yb;mj4V@ylrNS3us<5fk|c49^=duGVtL+;k$TC}ZQi&|@?wWW438ImJv zEWS)qwzWaJq1IRwZHfkcVVe(03j{^cFHKvZD3AmN7AX=mKm!yhk_P!ux07 zEs%WZy)#43a7aq3)|=YypO(fm_nvd^Ilp`7aUUAKa`T4PQp20IMn!3bW3F)*!?->g z4!c~g%j7pgeovEMhWuV5zaH}2`Ovh3K9^k=KJYa!kz%-?QP~jpv%t*ge~+FY{i6R{ z?7RNY`@Z7UJb&o^k=s48#=PzN_CW>@o8Nx^1RL6(W7;*XT2vn>JFP8wr>QpNQlqw0 zZyNhr(KwXJPC6cw_yS*$cdFW5r}*TRm274;8(zyT-dxLu7jp~Q+hM2B0XD=x%An$aCR{?i}$Z5^c{hjdi)^H&yKU9*NF2=`#En|B7WxukuT&o(}Vqgf;*N#d?liMEb0~Lvf|dC~F(yiR-fA~}gvN)qo<32lJ?>M=0hQ5>j5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backend/manage.py new file mode 100644 index 0000000..6ebbf71 --- /dev/null +++ b/backend/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +import os +import sys + +if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RateMyCourse.settings") + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) diff --git a/backend/postings/__init__.py b/backend/postings/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/postings/__pycache__/__init__.cpython-36.pyc b/backend/postings/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a6293fccf5f91e41b11393de4ed851d10c26a50 GIT binary patch literal 168 zcmXr!<>e~Wm>10e1dl-k3@`#24nSPY0whuxf*CX!{Z=v*frJsnuTW>Jn9$MwY5QbFjz8|FP`=Dp=&arTvdJiRl;$qxaxY`=NlnhSyaxE6-I^ncAi=)_A9%-Q+mV zI;)^X7fvLk0~limwMGx_lew7WWBVzxE4e}XDQj14QLYW-j!a|@xb?P|**d>p-N~Zz l@GxX{=MYXwZ_#U0qdZ1U`(cc)$$i(t%@iA_2=ibregQ;fQ2zh` literal 0 HcmV?d00001 diff --git a/backend/postings/__pycache__/apps.cpython-36.pyc b/backend/postings/__pycache__/apps.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..bb1238b210478ad403a7c8bc37f3560b1b6bb717 GIT binary patch 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 literal 0 HcmV?d00001 diff --git a/backend/postings/__pycache__/models.cpython-36.pyc b/backend/postings/__pycache__/models.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f6adad733f29b25c863f529b5c75aabbb0c5aec GIT binary patch literal 567 zcmY*Xy-ve05VrF})6fnEp-)_4fFK^dZl#nm7HY~))xa2MxPB=|SN&`wsk8p#V z&xD&mC&t1IOm3Z%uD!%_q)YWinsZ3xZR!3F6TvYqd4dK=KsgBvFeetL+<2vdy@of| za09W!%>@mbYrAeOsJAb(cm_hoYCeQn3=hjsq{kB6GhMUx&a}8mVmSuh z?`~>`u`Eh~G3_#j)fP#KTa4WoQBp^QflRvTjU#aqL&AftVx?6jYp0MP%EQ`Lu}VO< zeH6NgQ>YUvUAEHIjoUm^kg0bfI>=p_?{n`UyhI)ujzn}P!$AhVz&nLL$UBu!LvP@p z_Iu$Fsn6zKUI+>QooOyroQ-5ycYSX<7iF`{*OM+9hqkKe(rUlowRDqDqHL7!@tgXV d_F4I0Rrs&88f_tib`I+v9pM)tvTRJt`~k~>nb!aS literal 0 HcmV?d00001 diff --git a/backend/postings/admin.py b/backend/postings/admin.py new file mode 100644 index 0000000..05a8ce7 --- /dev/null +++ b/backend/postings/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin + +from .models import UniversityReview + +# Register your models here. +admin.site.register(UniversityReview) \ No newline at end of file diff --git a/backend/postings/api/__init__.py b/backend/postings/api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/postings/api/__pycache__/__init__.cpython-36.pyc b/backend/postings/api/__pycache__/__init__.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4901fdb05aa53a9c3d7f72fe49cc97cc271c09d5 GIT binary patch literal 172 zcmXr!<>lIuJujL82p)q77+?f49Dul(1xTbY1T$zd`mJOr0tq9CUy;sMF`>n&Ma41c zMTyzPG5&d}E=8GTsWC38#n~nK1u@S4E}nkwF+qtXslJuY`K3k0si>TS{Nj?#y!7Ij j#DdJ2`1s7c%#!$cy@JYH95%W6DWy57b|5Q@ftUdRZe1@> literal 0 HcmV?d00001 diff --git a/backend/postings/api/__pycache__/serializers.cpython-36.pyc b/backend/postings/api/__pycache__/serializers.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..10d24856fc990f7d8a5ea28af2005cdc90ab530d GIT binary patch literal 768 zcmZ`%&2AGh5VpPE&8khB0=HhcvX@-AA%rR=Qq@CJsZ}q_O4d?OgNgSC+uJI=7Kyju z&J*x1zH;IfI5FNRZHmB_Kh2Ci-;6)|^=P#B@!R5YhF z*i5r3$|Finh>RrvLL>+JiQh+gEaMB3CBHC-WYq6lFsjt*4va0Zo?vMWFxp*k^gfZDNzS?1gDCdDQbS`6= zEEDXSO1@-yA_vHy-o5-k|6~rX^sHU^arbZ;QI{3?*eR#MryX9p4;;wSfoQuATG@{v z{otyp9n@}-4SXv4Bq98s5LF{P4QLOA_}rB`WD8+}AU?)T&_20Vpr!SP21+TKTCc?> z@|~Dxc&>-v#q>>aiREpvH08<`XEn?WN?y#su3Xa=)3e#>;-omo#^&p3(-{j-owl(~ z)k|BHttxh2Z_=(k4|flm+UE!<<&4qoOd>|j3k)wZZuUb%!vLcIA^h0n#tIB3{IM99 zWe6$l{Y94e0|VBHYlAY}HfCkQwjXa>oAipkr-83aEaf2xB4|t!>eGbzj1s|w z5gUo=o0NblOrT5anFvcXUJc|nupMt|9x}fn_HK#W+EN_lvbsG>qbaN-c$${t4zEAT z)nurZEjo!yYg@u14~oa?aDH?#>E)|F7su{tr)uVzDo$i6&}61T0u`HgDrcuYNC*lT zxpr;o5G5H7lLkWVh-Hw5S+|t2l9pENKrOVZc2L8p0%WS*iF9<2hOgP+oX-?U#X}ja z6d$MH$!HDS1GOr$oDas{aCFV57<#iAWTjN_pXgsjX{dORM_fmD^G)6CC7CE==G z{}`M39gSoXN;U%lGcGvLn3vwn7e4kq>6fipAcDrEMuRYO0 zPbAyuX)9iI(c4@5Vo!FSv$*>aPhl~4(L_~B=b3TAEdL{~Obo7nUgeico7^tX)Mc)& zJ^}@U`|9q*b6lF1`75Py7JkWS)9u5t^B9|XfJQL^k_j$Bc*++o$))#(i9q_8OshHZ z=BTrUe1RuAKA&cEDn0b2Ho#^&Xe=wB;A@6!VHkVbN1qGpmxao#ab8-Mn2v8$IsU-( z9!~!KV(|Uw++a9T$NG>xU=hH6&uWxtW1s3_t4!`xnuUp7oiEU8Cn>D4?b^v z|4q|(81(-%$rjQT$^an`cj)@@=ch!MZsX!le0ew^IX8Sg!OoVi*RW!RSNKIs!Wv%l z6_;$<){jR2+l0(sYeceVO*=B_Aagj_-EJ* zq0FEI`#|VMaKLwX-#~MV_pDI|E+WMeOsCk)0U88`tzZl*{+_SAcT_S;8(ffSg_?~0 zCMo?ThB`mh6TGj}EBf9^&iN$NuW8$j67PRf;x;3S7{-zAW0a;sG-aSaCqq)vUyx~J z^)2=22JM(eTldjNenTR=(N@&aNQZeJtP$ylSluWCKjl!~T$#l7u4Iz-8<(%jtL z?!Tfo8=1=@ttR!Me7OxImc)ZIWp%DD)%jc^EO>jZu9sUCQZAxDXb?N0?N8{JCc4j% h+HDM_xKm718&%|@A8sz;Bl^`eznMPt==BbQe*n%zWD@`Y literal 0 HcmV?d00001 diff --git a/backend/postings/api/serializers.py b/backend/postings/api/serializers.py new file mode 100644 index 0000000..c129084 --- /dev/null +++ b/backend/postings/api/serializers.py @@ -0,0 +1,19 @@ +from rest_framework import serializers +from postings.models import UniversityReview + + +class UniversityReviewSerializer(serializers.ModelSerializer): + class Meta: + model = UniversityReview + fields = [ + 'pk', + 'university_name', + 'title', + 'username', + 'date_published', + 'content', + ] + read_only_fields =[ + 'pk', + 'username' + ] \ No newline at end of file diff --git a/backend/postings/api/urls.py b/backend/postings/api/urls.py new file mode 100644 index 0000000..d310315 --- /dev/null +++ b/backend/postings/api/urls.py @@ -0,0 +1,11 @@ +from .views import UniReviewRudView,UniReviewAPIView +from django.urls import re_path + + + + +urlpatterns = [ + + 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 new file mode 100644 index 0000000..8f22d4e --- /dev/null +++ b/backend/postings/api/views.py @@ -0,0 +1,28 @@ +from rest_framework import generics, mixins +from postings.models import UniversityReview +from .serializers import UniversityReviewSerializer +from django.db.models import Q + + +class UniReviewRudView(generics.RetrieveUpdateDestroyAPIView): + lookup_field = 'pk' + serializer_class = UniversityReviewSerializer + + def get_queryset(self): + return UniversityReview.objects.all() +class UniReviewAPIView(mixins.CreateModelMixin, generics.ListAPIView): + lookup_field = 'pk' + serializer_class = UniversityReviewSerializer + + def get_queryset(self): + qs = UniversityReview.objects.all() + query = self.request.GET.get("q") + if query is not None: + qs = qs.filter( + Q(title__icontains=query)| + Q(content__icontains=query) + ).distinct() + return qs + + def post(self,request,*args,**kwargs): + return self.create(request, *args, **kwargs) diff --git a/backend/postings/apps.py b/backend/postings/apps.py new file mode 100644 index 0000000..2e32823 --- /dev/null +++ b/backend/postings/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class PostingsConfig(AppConfig): + name = 'postings' diff --git a/backend/postings/migrations/0001_initial.py b/backend/postings/migrations/0001_initial.py new file mode 100644 index 0000000..3158aaa --- /dev/null +++ b/backend/postings/migrations/0001_initial.py @@ -0,0 +1,24 @@ +# Generated by Django 2.0.6 on 2018-09-16 10:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='UniversityReview', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('uni_name', models.CharField(max_length=200)), + ('user_name', models.CharField(max_length=200)), + ('date_published', models.DateTimeField(verbose_name='date published')), + ('content', models.CharField(max_length=200)), + ], + ), + ] diff --git a/backend/postings/migrations/0002_auto_20180916_1536.py b/backend/postings/migrations/0002_auto_20180916_1536.py new file mode 100644 index 0000000..c107033 --- /dev/null +++ b/backend/postings/migrations/0002_auto_20180916_1536.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0.6 on 2018-09-16 14:36 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('postings', '0001_initial'), + ] + + operations = [ + migrations.RenameField( + model_name='universityreview', + old_name='uni_name', + new_name='university_name', + ), + migrations.RenameField( + model_name='universityreview', + old_name='user_name', + new_name='username', + ), + ] diff --git a/backend/postings/migrations/0003_universityreview_title.py b/backend/postings/migrations/0003_universityreview_title.py new file mode 100644 index 0000000..cffb6b8 --- /dev/null +++ b/backend/postings/migrations/0003_universityreview_title.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.6 on 2018-09-16 15:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('postings', '0002_auto_20180916_1536'), + ] + + operations = [ + migrations.AddField( + model_name='universityreview', + name='title', + field=models.CharField(default='example', max_length=200), + preserve_default=False, + ), + ] diff --git a/backend/postings/migrations/__init__.py b/backend/postings/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/backend/postings/migrations/__pycache__/0001_initial.cpython-36.pyc b/backend/postings/migrations/__pycache__/0001_initial.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c803cc1dca868317a7cbdfc48afd247a71fd936e GIT binary patch literal 797 zcmY*X&2H2%5VoD{PqMpZL7agT(q2|Y+z_gYcGaqfwo+*?A(EBuOjBx6Rj@MSXHf#@KWIyClu^Bu{WRiZkW_nAr}Ud3c(FZqw>V8 zkP>sO8L1?vgR_O zp3C&bUjH2n)3A8MQ%5;vZsy{L*Zo*mBj4tC=ssF0>sHffHJ0LIzpx0i&x)<>di} ziva`>!T_RQTW=3y=T&|l!H^2<+u_-k*~X1Bt&o+mqb$qDTu9N1vd&+2Qrx08qFrgc z6?m7&6ydU5qJ6Q;^?@{?w<^GTosLxv8zk|rNBOWbs5e0e9nU=VwG&4V$fSEV=KTTA zZNfS6bu|(maemX4wY%Uvzy>9tyb@?MNzLs31-j%Hfi>7fHMr6257Vz4yE9K}`mwmA zx~3pWuT60-ai*!kVut3rRZTHHpM9O578hlUXRE2|w87`jR;Ob3D+MVw;bqq}^&ckf;!M`7bn OYe_ykX5%^^1^)mb^Q?9N literal 0 HcmV?d00001 diff --git a/backend/postings/migrations/__pycache__/0003_universityreview_title.cpython-36.pyc b/backend/postings/migrations/__pycache__/0003_universityreview_title.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7d01f6fc7610c68b7baa63265654592c113ab38d GIT binary patch literal 673 zcmZ8f&2G~`5MKYqKcrG_ozK|)_$7Nc)pqMv!^>d(f9S&k3TKOezCufOYsq1wMPI9tb&zR zVwHAcTkM2^4bBY%2d$;^#Yr4+-?OoINAI$+t)nu}q-gWHQhHF6TvyO|9Cz%9P%XlxSv*}?n>Z*K&QswPN;ws0_+H3Q+K<(pNludzmKWGhF+XuW5UD4A1 zV$BPzvi9{4nZ@Jf`Z-5$M*91GB+MxsKwLjKUX7~9e#GC44ep$>T8#kr0+Czh^2 ziiezEccL&%CIf7+0<6w+RMMtK9lQZJHWQ>{(r|VuWS{G(Zt%g`Z%po*Q3igi*~|0; zt)fyg{z|2170xB8PUonu+PX<+XY;pe~Wm>10e1dl-k3@`#24nSPY0whuxf*CX!{Z=v*frJsnuLNhSn9$