From 94b1926cdd8f36f59ad45b0a59140148452c7e54 Mon Sep 17 00:00:00 2001 From: Irwan Cahyono Date: Tue, 11 Mar 2025 10:24:22 +0700 Subject: [PATCH] pertama kali --- freekake_api/content/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 186 bytes .../content/__pycache__/admin.cpython-312.pyc | Bin 0 -> 230 bytes .../content/__pycache__/apps.cpython-312.pyc | Bin 0 -> 494 bytes .../__pycache__/models.cpython-312.pyc | Bin 0 -> 227 bytes freekake_api/content/admin.py | 3 + freekake_api/content/apps.py | 6 + freekake_api/content/migrations/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 197 bytes freekake_api/content/models.py | 3 + freekake_api/content/tests.py | 3 + freekake_api/content/views.py | 3 + freekake_api/core/__init__.py | 0 .../core/__pycache__/__init__.cpython-312.pyc | Bin 0 -> 183 bytes .../core/__pycache__/admin.cpython-312.pyc | Bin 0 -> 227 bytes .../core/__pycache__/apps.cpython-312.pyc | Bin 0 -> 485 bytes .../core/__pycache__/models.cpython-312.pyc | Bin 0 -> 2537 bytes .../__pycache__/serializers.cpython-312.pyc | Bin 0 -> 2990 bytes .../core/__pycache__/urls.cpython-312.pyc | Bin 0 -> 1141 bytes .../core/__pycache__/views.cpython-312.pyc | Bin 0 -> 4083 bytes freekake_api/core/admin.py | 3 + freekake_api/core/apps.py | 6 + freekake_api/core/migrations/0001_initial.py | 50 +++++++ freekake_api/core/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-312.pyc | Bin 0 -> 2499 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 194 bytes freekake_api/core/models.py | 32 +++++ freekake_api/core/serializers.py | 42 ++++++ freekake_api/core/tests.py | 3 + freekake_api/core/urls.py | 16 +++ freekake_api/core/views.py | 75 ++++++++++ freekake_api/db.sqlite3 | 0 freekake_api/freekake_api/__init__.py | 0 .../__pycache__/__init__.cpython-312.pyc | Bin 0 -> 191 bytes .../__pycache__/settings.cpython-312.pyc | Bin 0 -> 2717 bytes .../__pycache__/urls.cpython-312.pyc | Bin 0 -> 1048 bytes .../__pycache__/wsgi.cpython-312.pyc | Bin 0 -> 689 bytes freekake_api/freekake_api/asgi.py | 16 +++ freekake_api/freekake_api/settings.py | 133 ++++++++++++++++++ freekake_api/freekake_api/urls.py | 24 ++++ freekake_api/freekake_api/wsgi.py | 16 +++ freekake_api/manage.py | 22 +++ 42 files changed, 456 insertions(+) create mode 100644 freekake_api/content/__init__.py create mode 100644 freekake_api/content/__pycache__/__init__.cpython-312.pyc create mode 100644 freekake_api/content/__pycache__/admin.cpython-312.pyc create mode 100644 freekake_api/content/__pycache__/apps.cpython-312.pyc create mode 100644 freekake_api/content/__pycache__/models.cpython-312.pyc create mode 100644 freekake_api/content/admin.py create mode 100644 freekake_api/content/apps.py create mode 100644 freekake_api/content/migrations/__init__.py create mode 100644 freekake_api/content/migrations/__pycache__/__init__.cpython-312.pyc create mode 100644 freekake_api/content/models.py create mode 100644 freekake_api/content/tests.py create mode 100644 freekake_api/content/views.py create mode 100644 freekake_api/core/__init__.py create mode 100644 freekake_api/core/__pycache__/__init__.cpython-312.pyc create mode 100644 freekake_api/core/__pycache__/admin.cpython-312.pyc create mode 100644 freekake_api/core/__pycache__/apps.cpython-312.pyc create mode 100644 freekake_api/core/__pycache__/models.cpython-312.pyc create mode 100644 freekake_api/core/__pycache__/serializers.cpython-312.pyc create mode 100644 freekake_api/core/__pycache__/urls.cpython-312.pyc create mode 100644 freekake_api/core/__pycache__/views.cpython-312.pyc create mode 100644 freekake_api/core/admin.py create mode 100644 freekake_api/core/apps.py create mode 100644 freekake_api/core/migrations/0001_initial.py create mode 100644 freekake_api/core/migrations/__init__.py create mode 100644 freekake_api/core/migrations/__pycache__/0001_initial.cpython-312.pyc create mode 100644 freekake_api/core/migrations/__pycache__/__init__.cpython-312.pyc create mode 100644 freekake_api/core/models.py create mode 100644 freekake_api/core/serializers.py create mode 100644 freekake_api/core/tests.py create mode 100644 freekake_api/core/urls.py create mode 100644 freekake_api/core/views.py create mode 100644 freekake_api/db.sqlite3 create mode 100644 freekake_api/freekake_api/__init__.py create mode 100644 freekake_api/freekake_api/__pycache__/__init__.cpython-312.pyc create mode 100644 freekake_api/freekake_api/__pycache__/settings.cpython-312.pyc create mode 100644 freekake_api/freekake_api/__pycache__/urls.cpython-312.pyc create mode 100644 freekake_api/freekake_api/__pycache__/wsgi.cpython-312.pyc create mode 100644 freekake_api/freekake_api/asgi.py create mode 100644 freekake_api/freekake_api/settings.py create mode 100644 freekake_api/freekake_api/urls.py create mode 100644 freekake_api/freekake_api/wsgi.py create mode 100755 freekake_api/manage.py diff --git a/freekake_api/content/__init__.py b/freekake_api/content/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/freekake_api/content/__pycache__/__init__.cpython-312.pyc b/freekake_api/content/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18cd9dfc9f2e0f6e36746017f262ae8dec79d714 GIT binary patch literal 186 zcmX@j%ge<81UivN(?RrO5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!iqsD+PAw|d&nzlW z%+pIw%&5%I%hz|wPcF?(%_}L^FHbGX&df{KPtH$C)lVx*P0dcsPK{42$VBBN=jW9G u)$7N{XXa&=#K-FuRQ}?y$<0qG%}KQ@Vg=g72*kx8#z$sGM#ds$APWGii!t#4 literal 0 HcmV?d00001 diff --git a/freekake_api/content/__pycache__/admin.cpython-312.pyc b/freekake_api/content/__pycache__/admin.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..44e6807ccf6bcaba044a71b654bf9cf9cf9ed251 GIT binary patch literal 230 zcmX@j%ge<81UivN)9r!uV-N=hn4pZ$0zk%eh7^Vr#vF!R#wbQchDs()=9eI8O~zZS zi7C06d48HqxA;=B67$mY^^)`RN{TX*ikN{4Rx*4BsrwbCA6lGRRIHy_RGyfpmzBV{E(S3^Ff%eT-eXWGVgqsjkd!{Y literal 0 HcmV?d00001 diff --git a/freekake_api/content/__pycache__/apps.cpython-312.pyc b/freekake_api/content/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b755abbea7fe7fce551c238f0d05ee297514f707 GIT binary patch literal 494 zcmY*Vze~eF6n>YaTH8iMs^H+@A_OE^9Ym-W#id&Zvm9sc5@YkrOGAm9&_6(2`ZtJw zhm(tA2{<{q3Du>OcS#();l1y>_kEA|-m9*+K)i#?7w=Kz4@v%BqXvt80cJpfq5wi< zBLoVZ168I#Rfe9`N@pv%W;8w}F;KDAOOn$#a(&OK%2h-)S#$-M0RtORuoa4Il`6KD ztA%@g12W#jnFX8|o%ok~408buT1h=dH|qJ^;# zXMw~WjBhg%)Rj%jT#^N2OhgOpmOV6CdxC`=ZaK7uDdVZ-^9hMehg|1z6kGk+$wDzy zYE2j)`H^QiVi?QijE%^MVUqa&Nj;WDk|Z^goXcyLK@%X=MVP{T=kQJ2p0~UAeJ+2> z`oK_&cD=JSb9vv&-jS#jt_!qm9#uOY^9@1eX;XRDFBKv54tw7#3fg+O_yLhh*DoBD Bg3AB^ literal 0 HcmV?d00001 diff --git a/freekake_api/content/__pycache__/models.cpython-312.pyc b/freekake_api/content/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..742145ae009722b5a144eab7ce0f1c335d745c73 GIT binary patch literal 227 zcmX@j%ge<81UivN(=CDYV-N=hn4pZ$0zk%eh7^Vr#vF!R#wbQchDs()=9eI8O~zYn zx%nxnImLdOOt&~wvJ&&s^Yv1aikN|tD;Yk6)cgw94=qkDD%Q^|Do@PQOHRzF%+Jf$ zcgasK%}vcKDb_DfEy~W!OV>{Z8l<0Al$x5In4KD*SdfXzNzTtJ0jk%B*r!)e`HRB_ f$S%!EwJYKP+QSIM#URE9W=2NFdkiu~Y(NeGqrE+R literal 0 HcmV?d00001 diff --git a/freekake_api/content/admin.py b/freekake_api/content/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/freekake_api/content/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/freekake_api/content/apps.py b/freekake_api/content/apps.py new file mode 100644 index 0000000..273d169 --- /dev/null +++ b/freekake_api/content/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ContentConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'content' diff --git a/freekake_api/content/migrations/__init__.py b/freekake_api/content/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/freekake_api/content/migrations/__pycache__/__init__.cpython-312.pyc b/freekake_api/content/migrations/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6badfaf970c9d20ccc79f977b521790558cd3ef GIT binary patch literal 197 zcmX@j%ge<81UivN(?RrO5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!O3@E3PAw|d&nzlW z%+pIw%&5%I%hz|wPcF?(%_}L^FHbGX&df{KPtH$C)lVx*P0dcsPK{42$VBBN=jW9G z)$8YGrWYlaWaj4;>&M4u=4F<|$LkeT{^GF7%}*)KNwq6t1zO4o#Kj=SM`lJw#v*1Q F3jjn!HfR6< literal 0 HcmV?d00001 diff --git a/freekake_api/content/models.py b/freekake_api/content/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/freekake_api/content/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/freekake_api/content/tests.py b/freekake_api/content/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/freekake_api/content/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/freekake_api/content/views.py b/freekake_api/content/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/freekake_api/content/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/freekake_api/core/__init__.py b/freekake_api/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/freekake_api/core/__pycache__/__init__.cpython-312.pyc b/freekake_api/core/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0b3c2f4fa85d56f612569db5247a5688d291aead GIT binary patch literal 183 zcmX@j%ge<81Yz#y(n0iN5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!3eyiQPAw|d&nzlW z%+pIw%&5%I%hz|wPcF?(%_}L^FHbGX&df{KPtH$C)lVx*P0dcsPK{42$VBBN=NF~w s$H!;pWtPOp>lIY~;;_lhPbtkwwJTx;TEhs$#UREIO4SEjs8>+= ji^C>2KczG$)vkyGXa^$@7lRldm>C%v?=dJ8u>m;%)5krE literal 0 HcmV?d00001 diff --git a/freekake_api/core/__pycache__/apps.cpython-312.pyc b/freekake_api/core/__pycache__/apps.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..566a7d0e0e62f6b02e211c80d58dc7689607c0c2 GIT binary patch literal 485 zcmY*Vze~eF6n>YaQu{-+h|s~oMaYt@4kFYRyLAwB$a0*yON>o(@zPM@CUkUg>)#;$ zDS|kbfRmG(P+dBCm&Cz0y!U-wk(I|3ssyRlc zn?~N~bHPgQ-9Eh`k}lKWgbbxDJIg7z48OqdxDi3Ykh8CBupfBAZ8@8TymZ9h}#41rV|!T6MM$Q zIEZ}Pm6O<>U~Ejr43jwcPt;5{iQ~kIGog-HBtwFvEz=y9-J>^SZ`s_r9|-kQ^hc(i xH>+)xS*Wv?_Lf40a7&_f{kUB4L~Ki{E}E!oe(4CIcR2Xo&`{^G`vbBRu3uDfey#uj literal 0 HcmV?d00001 diff --git a/freekake_api/core/__pycache__/models.cpython-312.pyc b/freekake_api/core/__pycache__/models.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..418fb77fae9e7acb421119c3116037a762ddc5f7 GIT binary patch literal 2537 zcmdUxO-vg{6vt<5uf6s{OzV(BK`p7ElB)>k5^{+mAzU|26Dti3m0XF{W_K_P>ou9R zA&WTpzyVIs6IYH!>4BV@o_dWGsRGFoXr-Kb@~x8H3zzo2SsU4iiVvxkn8V+1X5P-c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_rwv?$O-80X_XkjLA0rRXT-KhL53$LnqSK`Jq$ms;&i#eH+{YMLBLSCZEE= zp5V-~&8p|tBNJcdEM9-Ylp;=i5!PJf*T4?4B$$2?I)rGK5z!O5t_{Xe2zm)oV&DMf zE7*Ys1M6c@4#;2Wm0!00NZ-1D7la=nAAu1Lo>urXTaI7jPN~*oIO6XzoX!vXzCiLx z9v(ll1n2J}*~h!?#%O*GI9Y(VHI#lf#w-2?4CH9$;q6oWCMte2j4O6WNIEAy2R%{6 zpF#^h9koZV7*$*`+3vmur5>5%GJ&{u(F~!oby#1K-vm2S*|(rWsPZ*LJW1IC^$Ma! zDLaoHXr71H$J`Fep3Oa&ef|E2sOx@;5f<70q> Az5oCK literal 0 HcmV?d00001 diff --git a/freekake_api/core/__pycache__/urls.cpython-312.pyc b/freekake_api/core/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c157b0d1368bee022761ca47341e5df278261a41 GIT binary patch literal 1141 zcmbu8J#W)M7{|}Co#s6RP=ZioWvQYpvC?FssTqhWkPt$Z7zl%9*_ZSZzeH!dA(>!f zWP>p)%2$9-fP}C-SXjz{nAlo%>%^TKlOUEtpW*KRy!`HY&M%+y`3xZTT>UcKO91eL zIYTy%c?Ki^WHb))qg;H*W*-$dI#$cI zSd!kV2*nPBS#nJTo!`K^ua zBGb7y8B5~4gy9gHDuTAGB8P0^{O(_&O?gH`wu6!C(DOF>cfpfJAI)yumEz_HXg*e=Uj)L^CcofY& zdw`r-R9V^ztZQ<;^{`PvA@$|K%?n&k^YW literal 0 HcmV?d00001 diff --git a/freekake_api/core/__pycache__/views.cpython-312.pyc b/freekake_api/core/__pycache__/views.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45e5f86321dc4af6f5c0a2ffad730b447d1e5022 GIT binary patch literal 4083 zcmd5<&2Q936d&(bO!mV`$j7#cvH{W%r%g7h3Q7^QMG4SKZ9q^^wHM2^Cy6)Sbr?HD z8?_>pP$f=qgCp07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cawc%)Zo%0^EtXG$v8F$5Dp0Vz^EDjc)V{ls0mKc1LY&dL{ z;duzZTNrH|Q1J}JdvW*8Gpc*^;SXBd6f^2N|!+NonliTyT8a zKR#V2(5UBP(%FaK1Ow;%fpc{Njd~^vJ}bfCtUowgC(x*mc1vTA5@MG) z*KT6ePLCWV54mvHxj9abEyt9L{n&V|sKev9Z_eq(epV?!r#GGGC)KuNDH?*R0|B0BA)~3HjLq$ErELV^uDS~qwPl=TC{(5YJ}afArKJy)L4Czm2T^!~iG1l8yG#!F zKJ#QMeeY(UXQzdGU-U&LKL10)7w0^2?j&{fN$RqjU3{?TXBWNf;xYgGf-5VoiMm`u7YR#|S^{RJWt=-M4OgnX z`Xnxn()ES3@cn0~IJ`s!0q4S-UIbgk@DHXqyzb~4F~jkH^}&M*-cWc8-=|&zS0zF{ v7e5N0=f|i_So+gp&y%SiVOjQ6VA%X$%(bV&d#vyv;Y$miwD61}OyJ-jgDN<= literal 0 HcmV?d00001 diff --git a/freekake_api/core/migrations/__pycache__/__init__.cpython-312.pyc b/freekake_api/core/migrations/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cefbae7e61d3f19494b2bf89aee35ed99242952f GIT binary patch literal 194 zcmX@j%ge<81Yz#y(n0iN5P=Rpvj9b=GgLBYGWxA#C}INgK7-W!O4JW6PAw|d&nzlW z%+pIw%&5%I%hz|wPcF?(%_}L^FHbGX&df{KPtH$C)lVx*P0dcsPK{42$VBBN=NF~w z=VqoCC6;97=N0S6$7kkcmc+;F6;%G>u*uC&Da}c>D`ExO$Oy#6AjU^#Mn=XWW*`dy Dn>aNz literal 0 HcmV?d00001 diff --git a/freekake_api/core/models.py b/freekake_api/core/models.py new file mode 100644 index 0000000..bffc6cf --- /dev/null +++ b/freekake_api/core/models.py @@ -0,0 +1,32 @@ +from django.db import models + +class Province(models.Model): + code = models.CharField(max_length=2, null=False) + name = models.CharField(max_length=255, null=False) + + def __str__(self): + return self.name + +class RegencyCity(models.Model): + code = models.CharField(max_length=4, null=False) + name = models.CharField(max_length=255, null=False) + province = models.ForeignKey(Province, on_delete=models.CASCADE, null=False) + + def __str__(self): + return self.name + +class District(models.Model): + code = models.CharField(max_length=6, null=False) + name = models.CharField(max_length=255, null=False) + regency_city = models.ForeignKey(RegencyCity, on_delete=models.CASCADE, null=False) + + def __str__(self): + return self.name + +class Village(models.Model): + code = models.CharField(max_length=10, null=False) + name = models.CharField(max_length=255, null=False) + district = models.ForeignKey(District, on_delete=models.CASCADE, null=False) + + def __str__(self): + return self.name \ No newline at end of file diff --git a/freekake_api/core/serializers.py b/freekake_api/core/serializers.py new file mode 100644 index 0000000..36c23c7 --- /dev/null +++ b/freekake_api/core/serializers.py @@ -0,0 +1,42 @@ +from rest_framework import serializers +from core import models + +class ProvinceSerializer(serializers.ModelSerializer): + + class Meta: + model = models.Province + fields = ['id', 'code', 'name'] + +class RegencyCitySerializer(serializers.ModelSerializer): + + class Meta: + model = models.RegencyCity + fields = ['id', 'code', 'name', 'province'] + +class RegencyCityDetailSerializer(serializers.ModelSerializer): + province = ProvinceSerializer(read_only=True) + + class Meta: + model = models.RegencyCity + fields = ['id', 'code', 'name', 'province'] + +class DistrictSerializer(serializers.ModelSerializer): + + class Meta: + model = models.District + fields = ['id', 'code', 'name', 'regency_city'] + + +class DistrictDetailSerializer(serializers.ModelSerializer): + regency_city = RegencyCityDetailSerializer() + + class Meta: + model = models.District + fields = ['id', 'code', 'name', 'regency_city'] + +class VillageSerializer(serializers.ModelSerializer): + district = DistrictSerializer() + + class Meta: + model = models.Village + fields = ['id', 'code', 'name', 'district'] \ No newline at end of file diff --git a/freekake_api/core/tests.py b/freekake_api/core/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/freekake_api/core/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/freekake_api/core/urls.py b/freekake_api/core/urls.py new file mode 100644 index 0000000..4c89f3b --- /dev/null +++ b/freekake_api/core/urls.py @@ -0,0 +1,16 @@ +from django.urls import path +from rest_framework.urlpatterns import format_suffix_patterns +from core import views + +urlpatterns = [ + path('provinces/', views.ProvinceList.as_view()), + path('provinces//', views.ProvinceDetail.as_view()), + + path('regencies_cities/', views.RegencyCityList.as_view()), + path('regencies_cities//', views.RegencyCityDetail.as_view()), + + path('districts/', views.DistrictList.as_view()), + path('districts//', views.DistrictDetail.as_view()), +] + +urlpatterns = format_suffix_patterns(urlpatterns) \ No newline at end of file diff --git a/freekake_api/core/views.py b/freekake_api/core/views.py new file mode 100644 index 0000000..8c4f72a --- /dev/null +++ b/freekake_api/core/views.py @@ -0,0 +1,75 @@ +from django.shortcuts import render +from rest_framework import generics + +from core import models, serializers + +# PROVINCES + +class ProvinceList(generics.ListCreateAPIView): + queryset = models.Province.objects.all() + serializer_class = serializers.ProvinceSerializer + search_fields = ['name', 'code'] + filterset_fields = ['name', 'code'] + ordering_fields = '__all__' + +class ProvinceDetail(generics.RetrieveUpdateDestroyAPIView): + queryset = models.Province.objects.all() + serializer_class = serializers.ProvinceSerializer + +# REGENCY/CITY + +class RegencyCityList(generics.ListCreateAPIView): + queryset = models.RegencyCity.objects.all() + serializer_class = serializers.RegencyCitySerializer + search_fields = ['name', 'code'] + filterset_fields = ['name', 'code'] + ordering_fields = '__all__' + + def get_serializer_class(self): + serializer_class = self.serializer_class + + if self.request.method == 'GET': + serializer_class = serializers.RegencyCityDetailSerializer + + return serializer_class + +class RegencyCityDetail(generics.RetrieveUpdateDestroyAPIView): + queryset = models.RegencyCity.objects.all() + serializer_class = serializers.RegencyCitySerializer + + def get_serializer_class(self): + serializer_class = self.serializer_class + + if self.request.method == 'GET': + serializer_class = serializers.RegencyCityDetailSerializer + + return serializer_class + +# DISTRICT + +class DistrictList(generics.ListCreateAPIView): + queryset = models.District.objects.all() + serializer_class = serializers.DistrictSerializer + search_fields = ['name', 'code'] + filterset_fields = ['name', 'code'] + ordering_fields = '__all__' + + def get_serializer_class(self): + serializer_class = self.serializer_class + + if self.request.method == 'GET': + serializer_class = serializers.DistrictDetailSerializer + + return serializer_class + +class DistrictDetail(generics.RetrieveUpdateDestroyAPIView): + queryset = models.District.objects.all() + serializer_class = serializers.DistrictSerializer + + def get_serializer_class(self): + serializer_class = self.serializer_class + + if self.request.method == 'GET': + serializer_class = serializers.DistrictDetailSerializer + + return serializer_class \ No newline at end of file diff --git a/freekake_api/db.sqlite3 b/freekake_api/db.sqlite3 new file mode 100644 index 0000000..e69de29 diff --git a/freekake_api/freekake_api/__init__.py b/freekake_api/freekake_api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/freekake_api/freekake_api/__pycache__/__init__.cpython-312.pyc b/freekake_api/freekake_api/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e11371d61c7d73cb158707061963b4cb8e895b2 GIT binary patch literal 191 zcmX@j%ge<81d}6$AGg2m*M7*C%50h8}I#Hk$OQN-kX5jDbd5e`T2+)w;SYd<+LJAM8%p6-V} zPWOY^i}utQnp5K_swTRen(T6D{s&%7!7~QWG>WSk1QHZQfh_d{Pk5C6KHBBgEXt@k zltnqTfbwV&70?+}{60o_bpf44=Rof)IvqFMltXW&;vuc~L! zCH36VYo*uqWjI)>y02SZTcFtUh}ES+$99E|i}8VefHmDAg5%oz*zm+uY7<-7)jf=a z-6P>`6dGRFQIA*x^>o)8YrZY?DL@HhS-NU@8Lt+ zJzxok9vQaNy}_aeB$CC)zDsfc`WU815Hj(h?qV?{gm_1y5-qYQ}5c4;ZwboKtLfYQe!dbkz-L5qoiht=JtR2!W z5p~A_zQbg)IKmyhZ+iY);{ed^DT$6vy)LxCSElx?@E4}=91ZP4PmHx#N~gN1BYpYC z3QL-{p__XkV$s!`D>q6p7LyyBwT8^14QUI;9Yt=j#I~d;_nIv@z@4VjhC8L%YP&_a zVEj8XjD%I`=#)YyA`LDvg2E$+I~2Q;7f{^yutIvo)PrWbJJPUS|MtrwZ4ry~`n@`~ zy58QY{l_nBKWf75ag3(`pS&zUqu;|WF`h@5$JX^eWpg|2iXVqp4K!ofzchx0l=WY?ERQAD zB}EQOh@}*{(vsWSr}7tUzACTpY_hCWuQ%_>RV~Ps!g95S(uOVAfVxvyYO7YQ*5!Lr zOJIIsC7_VB+VTet77J!=6(Vl~awYK23RQVS z+NrlSKyGRqHMw5>k$W1v!T$QP98?Z16ZcTJL_^;@vMsw@wGBvu<B|q(mw!!Pd6d5TFn#q=dih~`d5{?9xLk`Lq=qprnH|iZ`u6xcMu&;at3!dYsJ6$A)vcY-Ere3S4pJ0hb5V`P^~g z!{hwr%mxz&eU!CeMQ{ss*sltTaj literal 0 HcmV?d00001 diff --git a/freekake_api/freekake_api/__pycache__/urls.cpython-312.pyc b/freekake_api/freekake_api/__pycache__/urls.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..99cb0e535d3c509b4e521f2f7bed1427bc5359be GIT binary patch literal 1048 zcmb7D&ubJh6wb`f?CO--ga1H0$m~d+P(cgp4-jjyAR=Nfd)cOw?Cx|Y$&h5M+nadt z>Pi0vDfo{FUV7V$2T$HwikF^znVp42P&9|+8LA-O)JGR^3Cs-z-YDysyS){sN4C*UK=6ys$1Tl{6?981gT#ie^fv8vz?^eVJ+ y-_YEE>9pl}-kHDV1wS$Ju6;w-&mz>0-o@`XKi)mL8lQyS(@wDFzgf{MQ2qezw6t?d|Q(b6;5b10omPl}J2Nr~okWxYrq(fVQvRvHrOXB3tKG{w}x^-ek z4EzSv-@(LE1QODT0fZRXK-oIsYZ{t~H`w3v)Azpb+5WJx5g-?DUcB$W#t8i=l4X=G z!2HmGw}_(-;+T60?qIk3iI@5vA0xoS^(EzUA672$67dqha^fvAj64MX$wjHNHuLIh zM_+^Id(9S!mF$T==_yTm8eqgm5V1^KH6-suyuHPdkl`0KHNT-^f7l@LsxiF+B61Yta zKrpa2GxsRvDmEb>GTB#4Pq9iVNP0KirUNy#igL&jHA_KSIyHSkgI~q0?K;kH^ub2O znH%b#jeN850ff#sgh-Qtp=_v*niGKF0WuSH`9Jb%cYTX!{%T hUIoX&7gYO*YNwmw=~nYIdi=e5^HcTKaYbKsq`!3)&g1|9 literal 0 HcmV?d00001 diff --git a/freekake_api/freekake_api/asgi.py b/freekake_api/freekake_api/asgi.py new file mode 100644 index 0000000..606b317 --- /dev/null +++ b/freekake_api/freekake_api/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for freekake_api project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'freekake_api.settings') + +application = get_asgi_application() diff --git a/freekake_api/freekake_api/settings.py b/freekake_api/freekake_api/settings.py new file mode 100644 index 0000000..1afa8ed --- /dev/null +++ b/freekake_api/freekake_api/settings.py @@ -0,0 +1,133 @@ +""" +Django settings for freekake_api project. + +Generated by 'django-admin startproject' using Django 5.1.6. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.1/ref/settings/ +""" + +from pathlib import Path + +# 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/5.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-@wf_1z20edr655upw6t3tf==56!t%vk(oky=v4+n0io+om=4^x' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'rest_framework', + 'psycopg2', + + 'core', + 'content', +] + +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 = 'freekake_api.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 = 'freekake_api.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'freekake_app_db', + 'USER': 'postgres', + 'PASSWORD': 'asalada123', + 'HOST': 'localhost', + 'PORT': '5432', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.1/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', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/5.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.1/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/freekake_api/freekake_api/urls.py b/freekake_api/freekake_api/urls.py new file mode 100644 index 0000000..9bc829e --- /dev/null +++ b/freekake_api/freekake_api/urls.py @@ -0,0 +1,24 @@ +""" +URL configuration for freekake_api project. + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/5.1/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 path, include + +urlpatterns = [ + # path('admin/', admin.site.urls), + + path('core/', include('core.urls')), +] diff --git a/freekake_api/freekake_api/wsgi.py b/freekake_api/freekake_api/wsgi.py new file mode 100644 index 0000000..d8759e6 --- /dev/null +++ b/freekake_api/freekake_api/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for freekake_api 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/5.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'freekake_api.settings') + +application = get_wsgi_application() diff --git a/freekake_api/manage.py b/freekake_api/manage.py new file mode 100755 index 0000000..b244e5d --- /dev/null +++ b/freekake_api/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + """Run administrative tasks.""" + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'freekake_api.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) + + +if __name__ == '__main__': + main()