From 843a054058550078fd14bac8eb3874eb16a3b600 Mon Sep 17 00:00:00 2001 From: Fatima Almashi Date: Mon, 1 Aug 2022 23:53:57 +0300 Subject: [PATCH] :( --- eCommerce/brand/__init__.py | 0 .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 201 bytes .../brand/__pycache__/admin.cpython-310.pyc | Bin 0 -> 242 bytes .../brand/__pycache__/apps.cpython-310.pyc | Bin 0 -> 478 bytes .../brand/__pycache__/models.cpython-310.pyc | Bin 0 -> 987 bytes .../__pycache__/serializers.cpython-310.pyc | Bin 0 -> 672 bytes .../brand/__pycache__/urls.cpython-310.pyc | Bin 0 -> 808 bytes .../brand/__pycache__/views.cpython-310.pyc | Bin 0 -> 3842 bytes eCommerce/brand/admin.py | 3 + eCommerce/brand/apps.py | 6 + eCommerce/brand/migrations/0001_initial.py | 38 +++++ .../migrations/0002_alter_product_price.py | 18 +++ eCommerce/brand/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-310.pyc | Bin 0 -> 1223 bytes .../0002_alter_product_price.cpython-310.pyc | Bin 0 -> 667 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 212 bytes eCommerce/brand/models.py | 19 +++ eCommerce/brand/serializers.py | 10 ++ eCommerce/brand/tests.py | 3 + eCommerce/brand/urls.py | 19 +++ eCommerce/brand/views.py | 138 ++++++++++++++++++ eCommerce/db.sqlite3 | Bin 0 -> 147456 bytes eCommerce/eCommerce/__init__.py | 0 .../__pycache__/__init__.cpython-310.pyc | Bin 0 -> 205 bytes .../__pycache__/settings.cpython-310.pyc | Bin 0 -> 2358 bytes .../__pycache__/urls.cpython-310.pyc | Bin 0 -> 1037 bytes .../__pycache__/wsgi.cpython-310.pyc | Bin 0 -> 612 bytes eCommerce/eCommerce/asgi.py | 16 ++ eCommerce/eCommerce/settings.py | 125 ++++++++++++++++ eCommerce/eCommerce/urls.py | 22 +++ eCommerce/eCommerce/wsgi.py | 16 ++ eCommerce/manage.py | 22 +++ 32 files changed, 455 insertions(+) create mode 100644 eCommerce/brand/__init__.py create mode 100644 eCommerce/brand/__pycache__/__init__.cpython-310.pyc create mode 100644 eCommerce/brand/__pycache__/admin.cpython-310.pyc create mode 100644 eCommerce/brand/__pycache__/apps.cpython-310.pyc create mode 100644 eCommerce/brand/__pycache__/models.cpython-310.pyc create mode 100644 eCommerce/brand/__pycache__/serializers.cpython-310.pyc create mode 100644 eCommerce/brand/__pycache__/urls.cpython-310.pyc create mode 100644 eCommerce/brand/__pycache__/views.cpython-310.pyc create mode 100644 eCommerce/brand/admin.py create mode 100644 eCommerce/brand/apps.py create mode 100644 eCommerce/brand/migrations/0001_initial.py create mode 100644 eCommerce/brand/migrations/0002_alter_product_price.py create mode 100644 eCommerce/brand/migrations/__init__.py create mode 100644 eCommerce/brand/migrations/__pycache__/0001_initial.cpython-310.pyc create mode 100644 eCommerce/brand/migrations/__pycache__/0002_alter_product_price.cpython-310.pyc create mode 100644 eCommerce/brand/migrations/__pycache__/__init__.cpython-310.pyc create mode 100644 eCommerce/brand/models.py create mode 100644 eCommerce/brand/serializers.py create mode 100644 eCommerce/brand/tests.py create mode 100644 eCommerce/brand/urls.py create mode 100644 eCommerce/brand/views.py create mode 100644 eCommerce/db.sqlite3 create mode 100644 eCommerce/eCommerce/__init__.py create mode 100644 eCommerce/eCommerce/__pycache__/__init__.cpython-310.pyc create mode 100644 eCommerce/eCommerce/__pycache__/settings.cpython-310.pyc create mode 100644 eCommerce/eCommerce/__pycache__/urls.cpython-310.pyc create mode 100644 eCommerce/eCommerce/__pycache__/wsgi.cpython-310.pyc create mode 100644 eCommerce/eCommerce/asgi.py create mode 100644 eCommerce/eCommerce/settings.py create mode 100644 eCommerce/eCommerce/urls.py create mode 100644 eCommerce/eCommerce/wsgi.py create mode 100755 eCommerce/manage.py diff --git a/eCommerce/brand/__init__.py b/eCommerce/brand/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/eCommerce/brand/__pycache__/__init__.cpython-310.pyc b/eCommerce/brand/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..06296c6f3f27ccfcbeff1fa684c10f4270a1393f GIT binary patch literal 201 zcmd1j<>g`kf*BGol0fuh5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;x_cerR!OQL%nn zVo7FhVq#8iVsS>MzDs^`X>Mv>NwL05R$^XyzHUHKepYHSi0|d-=k6aL*doS&PUT9llspH!5Xm!cmZpP83g5+AQuPl Ag`kf*BGolI(%>V-N=!FabFZKwK;UBvKes7;_kM8KW2(8B&;n88n$+0!0}# z8E>&BrsQVk`Drpm@ug%X=B4NBCFkdr6lEqAfecv5P{a(Rz{Iai{m|mnqGJ8D#FEV1 z#KfH3#Nv!heV6>?(%jU%l45-quzuZuqWrAXWDwuW(a+sKKFBpVB;Lo-$plj%)j2;m oH?=4^RX?dHF)u|Q>=wO(%3B;Zx%nxjIjMGxK--H!E)ie=0BYDiIsgCw literal 0 HcmV?d00001 diff --git a/eCommerce/brand/__pycache__/apps.cpython-310.pyc b/eCommerce/brand/__pycache__/apps.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..df3a9af9c068ab9229b2e3d61dbad24b352f2188 GIT binary patch literal 478 zcmZWlJx{|h5VhkJg?=ok0}B#s29kvlp{6ZVLMR{#OBTzGoiioV+4V z1b!ir#qBwAJKumpE^hXNqL`>WNtdzd>>7q*1g?h=1d1?6a2rR2TanEPu-Hv+T(X>R z2%eAln&nI7@r5T97n%0P=`yG*b(xBcH=TvShHj^ED9xD^lr~*T0a|A!?^F6%vury# z;38plR#657G-(-ZGy6cL*+d(DR{nz)rS=n6rIN8sGQCRusfueU@=E*DR?*3Asn#Mk z^;HngZs^^`{GMJ1vi^`O@{XPf_?o9${t*hfS13yraOxBvhE literal 0 HcmV?d00001 diff --git a/eCommerce/brand/__pycache__/models.cpython-310.pyc b/eCommerce/brand/__pycache__/models.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..57bfb88441f03c2ed9e178018ae309735e65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nFdEq+3CS;rCfvtB0`|6qb8j zFD09-i6AFyPWxI+9Pn~mxhu!uK}eeYeM`pr36k;tJx%HVx`gy=OX@CuSTk;yblEn4 E13asoS^xk5 literal 0 HcmV?d00001 diff --git a/eCommerce/brand/__pycache__/urls.cpython-310.pyc b/eCommerce/brand/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21cf882aeafa59a21b4bac1e3f79bd56e53862d0 GIT binary patch literal 808 zcmZXS%Wl*#6o#G4Oq0oF=umEzcz{_@Z^~{|wJ-MA9XXhR3eAk6#%^P zQIobn?p$ON2hx-`LAudZH=^swt^`p@K5L!H22OYrcD2q@Pe7*fUq@Fnj;K@x?3R`0 z?ZN>qY)bXDF-1C&&L6gU9DT|YZ9{=8Vw_17lGUldEaer{s?8)8}4U!NHN9dT3F&rghV zOWfA=3!<`bR9C(wJgY1=yWS~oj(g%apZZC>=c$vht31?a_q-=PPem6j&Zx+Zdg@z1 zZd7?}-Tn})mT@(YO zjZ7{X=S)W&5!aE4$kdUA$cos24fwzuSi*i`o!bNZ75}%9j)yF%_s}!OfbQ}HU@0Vc+SqbFb7;%FZsENteBD2wvjWA++=EF z19FT(gxJTW-bHZ)I{di=DzG*NYtxUwPJ zC2M4pVgYS&egnCWT4Cqp-U^--efwRbf17F(K-B6+5VqVv-9s?!+n?L4&_g9WtZW8B zLIzdkl8|fI2VwY?l0@igCSgN1JkUvsO*aTMD~Y2?u* z{dQyODsIvT<#qI!Tts1Hwztr(D2aJqX58c~^S`nsX>GB&`?%hs1rC2E0=jhO_7G6! z2wK5jAYV|KDWJRoZ(2Hr_7K}ThWZd^bZqN5JK(Pz(q5D!C-vc$T6Y&rE@SMG)LcqR z!_{B-GVIBUPEW;GmEH+N0D-Mk^BOyO8*j(vkr&BpKQzu9HE6Aw8pGJp!!^N(o76;l z8p(Pw`9=cr&(Nkwn`N`ei;VspR^;+WsERXN+n;aOx5r?k@6eV+uzmMe6#dc!aQu}? zKzw0z7cC>Q&OTr;EoStKku4wtg60eO-Iv&+&dq1$etJJ;r-trf4R|~AFXJ1Yf@s&| zd-zTYSN+(#LaQ4_m4{)kD^~i;!VA2}t3+r&41*v%^}9!DPk0cylEzZLk0{P0z2n^W z-&&qF!-STEM9M_@0lh*1#>{&I!{q%0!{4CKca&CcmVsZHEi&it{QEgm{v4HWsQc0` z9-=iOvri}oWs`BpDcm)J-9lsu(z-3ompsa}v%(_FK&>q@K0}R@)Ks&zD$@k%FSWv6 zAi6(}DlP5R6}NJd>`NDkK;w)jWhfJcCZH~-+f`*#2yk!I)>o=IS-?E?;IZSY=2L8F zLSAxCu2HL&^Q@Nh-Sv-~4|n$N|6yxuyVjUaC4Q&*U~hY~zP$yTAf3mv>8zS?`E-w* z1i3)IoOXMJcNFoiXgWO4=J_m_AK`HfT@w|T=n{jk%owJt4fzFcTjv}+OYK<8)UMUx zlaAlTcGzusvDI~tSWQ)3xs1zw5bgjDN+3cML##LL@00>3N+8&PZc;td?E!#b~{7N z`9U4R&cI8Dwy1M!V7rlB;NX{myPe-%D#$qoPUK`BN&01e%lakdt?t zwVgV6`M9<G|Hdgp*m)G0MMJnFSWdzZ?(L19u=706)`n5RSbTGPi%GF zjyE*B-%{HK6?&nQYfSAf9s3FO`;dy?qZnJw7%2r>`}5KR^D!#$zQrZ1@=KSfKex)^7VaiR_U z14)OH#uCoIQS(qDC8weMYE^ixP`VNMG`U)1VWJ(6`X3Wb^~U@gt@>XTN!f_Y^VH#6qtBPl2ENh@ynFQD jjv~7*8p#=>$RP&inA6Oe!BxanPVXh$9bB{YJjebICvHX> literal 0 HcmV?d00001 diff --git a/eCommerce/brand/admin.py b/eCommerce/brand/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/eCommerce/brand/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/eCommerce/brand/apps.py b/eCommerce/brand/apps.py new file mode 100644 index 00000000..cb0a8d86 --- /dev/null +++ b/eCommerce/brand/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class BrandConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'brand' diff --git a/eCommerce/brand/migrations/0001_initial.py b/eCommerce/brand/migrations/0001_initial.py new file mode 100644 index 00000000..da8ca3cc --- /dev/null +++ b/eCommerce/brand/migrations/0001_initial.py @@ -0,0 +1,38 @@ +# Generated by Django 4.0.6 on 2022-08-01 19:33 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Brand', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=512)), + ('description', models.TextField()), + ('established_at', models.DateField()), + ('city', models.CharField(max_length=512)), + ], + ), + migrations.CreateModel( + name='Product', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=128)), + ('description', models.TextField()), + ('image_url', models.URLField()), + ('price', models.DecimalField(decimal_places=10, max_digits=10)), + ('quantity', models.IntegerField()), + ('is_active', models.BooleanField()), + ('brand', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='brand.brand')), + ], + ), + ] diff --git a/eCommerce/brand/migrations/0002_alter_product_price.py b/eCommerce/brand/migrations/0002_alter_product_price.py new file mode 100644 index 00000000..210e8bdf --- /dev/null +++ b/eCommerce/brand/migrations/0002_alter_product_price.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.6 on 2022-08-01 20:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('brand', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='product', + name='price', + field=models.DecimalField(decimal_places=2, max_digits=10), + ), + ] diff --git a/eCommerce/brand/migrations/__init__.py b/eCommerce/brand/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/eCommerce/brand/migrations/__pycache__/0001_initial.cpython-310.pyc b/eCommerce/brand/migrations/__pycache__/0001_initial.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d75dff33fab6c86d39f1ddb37716f2bac916dfca GIT binary patch literal 1223 zcmZuxUvJws5SM7lmTkpJ+B9poPv8Nwv#pOqQO9nIZf!O+>5E5oU!Mbo|v zSYPuUw#R)Xz780c4=`ZZfMO@gT>^9@c)EW)-u;eLy|p#)XuSROkEIAb@3%&{IRX+M z($W(m;DKLwrJwjEOPJrttmq`cV-GqIy!9YJKM#NEBq6X9Zya9H9&gO-pp=;sM%Ics3_94$Bk*Yk5JLAdIAhQwT^}Oo zU-~2su=n%e7mv6haYM(&H$Actwl0~AH~Qar+s=FEgLu0XFLv>6k;fL?rnz^?=%hPj z89B>7aodjjhBjGlW=6& zlf^i&u~?g$rwWBZu)~#-rBE0Ad%UoHjY^6_zD66rM769n@=BCwLnBRr(qja@Ptc23 zyud0m=XMCFQzchTBkTyZ5z9jAa|AAo4N_??s8@jt(mj({fVREwR1NFYs9kEx)sIAM zpK{2MuT^0~N+`vv<_6Ku5nxKTg0BjZqHd1{nMtE<^ut!M@^NsKR*|0!=BQMI0uF65%hYRh10BUf9~f!=&}GM_CT*+IR+&GY!xQ(sbo zj{N;*`huFQr)TtZN+F6;=yN$;)akm!%IN9BMg5Fglw;b+U(b#of6JdgIyvP}XNUJc zRN%ZWOH?UN9op0DcR4*cIQX1zK%A^DRP*qAwDcE5A}?Sx1Lp6skw2h0^4UMZyI^pw z*>U>2KKmkGrqQIyz5kSx_HQtG4~lAjGj8uS4lQ?|3^w|zZT|zm N$*fCcheiH==U>ozXcPbd literal 0 HcmV?d00001 diff --git a/eCommerce/brand/migrations/__pycache__/0002_alter_product_price.cpython-310.pyc b/eCommerce/brand/migrations/__pycache__/0002_alter_product_price.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a0908e73f4a60110fe83acfd943c4e773770ba0 GIT binary patch literal 667 zcmZWn&5qMB5VoD9O`|SC9DpZ4>Vc;G91+?=VI>3wv2e-7ax=5VRh(q)RDv@|NJ#r2 zypm5yT<9wxp=F#d+Lai|6Mr)ke>0!m92{hf?8k#&t8bjKp8;I8n7|<|cZVD>;1x5x z;6@aJvm*uqqAv_0aOfoT9MSBBJ88xlCA<)-A2 z6&zS0fUkKGVZ2EK0S-1ph#`T&nSkM0M7b1FA{zP8tA7kcm#nO+!H;LN**&Ri-Dy?% zVQU-MmYq*pt4rJoqS=L+>4$58r8cUPZKXpQczsGxVhzvk~9T9==YmPV<{DEC3BNftUH%4HmY7Xci-4%gJr-k=F6kk^6j(Z zck<=@$;1Bx__Q$wZHalWS$=s@IjMJFs?evrkdD5j+_e2HJLlAyM- literal 0 HcmV?d00001 diff --git a/eCommerce/brand/migrations/__pycache__/__init__.cpython-310.pyc b/eCommerce/brand/migrations/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e70c36ba0c99cad0080e20721b4a168ae6110610 GIT binary patch literal 212 zcmd1j<>g`kf*BGol0fuh5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;x_{erR!OQL%nn zVo7FhVq#8iVsS>MzDs^`X>Mv>NwL05R$^XyzHUHKepYHSi0|d-=k6aL*doS&PUT9llspH!5Xm!hAWnO+1mJU_2kKR!M)FS8^*Uaz3?7Kcr4eoARhsvXEd K#Y{kgg#iGY*f(1M literal 0 HcmV?d00001 diff --git a/eCommerce/brand/models.py b/eCommerce/brand/models.py new file mode 100644 index 00000000..dcf0bdfd --- /dev/null +++ b/eCommerce/brand/models.py @@ -0,0 +1,19 @@ +from django.db import models + +# Create your models here. + +class Brand(models.Model): + title = models.CharField(max_length=512) + description = models.TextField() + established_at = models.DateField() + city = models.CharField(max_length=512) + + +class Product(models.Model): + brand = models.ForeignKey(Brand, on_delete=models.CASCADE) + name = models.CharField(max_length=128) + description = models.TextField() + image_url = models.URLField() + price = models.DecimalField(max_digits=10, decimal_places=2) + quantity = models.IntegerField() + is_active = models.BooleanField() \ No newline at end of file diff --git a/eCommerce/brand/serializers.py b/eCommerce/brand/serializers.py new file mode 100644 index 00000000..6cfc2f55 --- /dev/null +++ b/eCommerce/brand/serializers.py @@ -0,0 +1,10 @@ +from rest_framework import serializers + +from .models import Product + + +class ProductSerializer(serializers.ModelSerializer): + + class Meta: + model = Product + fields = '__all__' \ No newline at end of file diff --git a/eCommerce/brand/tests.py b/eCommerce/brand/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/eCommerce/brand/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/eCommerce/brand/urls.py b/eCommerce/brand/urls.py new file mode 100644 index 00000000..c2789ab3 --- /dev/null +++ b/eCommerce/brand/urls.py @@ -0,0 +1,19 @@ +from django.urls import path + +from . import views + +app_name = "brand" + +urlpatterns = [ + path("add/", views.add_brand, name="add_brand"), + path("all/", views.list_brands, name="list_brands"), + path("update//", views.update_brand, name="update_brand"), + path("delete//", views.delete_brand, name="delete_brand"), + + path("products/add/", views.add_product, name="add_product"), + path("products/all/", views.list_products, name="list_products"), + path("products/update//", views.update_product, name="update_product"), + path("products/delete//", views.delete_product, name="delete_product"), + path("products/get//", views.get_product, name="get_product"), + +] diff --git a/eCommerce/brand/views.py b/eCommerce/brand/views.py new file mode 100644 index 00000000..ec60bf1e --- /dev/null +++ b/eCommerce/brand/views.py @@ -0,0 +1,138 @@ +from hashlib import new +from rest_framework.decorators import api_view +from rest_framework.response import Response +from rest_framework.request import Request + +from rest_framework import status + +from .models import Brand, Product +from .serializers import ProductSerializer + + +@api_view(["POST"]) +def add_brand(request : Request): + + title = request.data["title"] + description = request.data["description"] + established_at = request.data["established_at"] + city = request.data["city"] + + new_brand = Brand(title=title, description=description, established_at=established_at, city=city) + new_brand.save() + + res_data = { + "msg" : "Created Brand Successfully" + } + + return Response(res_data) + + +@api_view(["GET"]) +def list_brands(request : Request): + all_brands=Brand.objects.all() + all_brands_list = [{"id" : brand.id, "title" : brand.title, "description": brand.description, "city": brand.city} for brand in all_brands] + + res_data = { + "msg" : "A list of All Brands", + "books" : all_brands_list + } + return Response(res_data, status=status.HTTP_200_OK) + + + +@api_view(['PUT']) +def update_brand(request : Request, brand_id): + + brand=Brand.objects.get(id=brand_id) + + brand.title = request.data["title"] + brand.description = request.data["description"] + brand.established_at = request.data["established_at"] + brand.city = request.data["city"] + brand.save() + + return Response({"msg" : "Your brand is updated !"}) + + + +@api_view(["DELETE"]) +def delete_brand(request : Request, brand_id): + + try: + brand = Brand.objects.get(id=brand_id) + brand.delete() + except Exception as e: + return Response({"msg" : "The brand is not Found!"}) + + return Response({"msg" : f"delete the following brand {brand.title}"}) + + + +@api_view(['POST']) +def add_product(request : Request): + + product_serializer = ProductSerializer(data=request.data) + + if product_serializer.is_valid(): + product_serializer.save() + else: + return Response({"msg" : "couldn't create a product", "errors" : product_serializer.errors}, status=status.HTTP_403_FORBIDDEN) + + return Response({"msg" : "Product Added Successfully!"}, status=status.HTTP_201_CREATED) + + + +@api_view(['GET']) +def list_products(request : Request): + + products = Product.objects.all() + products_data = ProductSerializer(instance=products, many=True).data + + return Response({"msg" : "list of all products", "products" : products_data}) + + +@api_view(['PUT']) +def update_product(request : Request, product_id): + + try: + product = Product.objects.get(id=product_id) + except Exception as e: + return Response({"msg" : "This product is not found"}, status=status.HTTP_404_NOT_FOUND) + + product_serializer = ProductSerializer(instance=product, data=request.data) + + if product_serializer.is_valid(): + product_serializer.save() + else: + return Response({"msg" : "couldn't update", "errors" : product_serializer.errors}) + + return Response({"msg" : "Product updated successfully"}) + + + +@api_view(["DELETE"]) +def delete_product(request : Request, product_id): + + try: + product = Product.objects.get(id=product_id) + product.delete() + except Exception as e: + return Response({"msg" : "The product is not Found!"}) + + return Response({"msg" : f"delete the following product {product.name}"}) + + + +@api_view(['GET']) +def get_product(request : Request, product_id): + + try: + product = Product.objects.get(id=product_id) + product_serializer = ProductSerializer(instance=product, data=request.data) + return Response({"msg" : "Product updated successfully", "product": product_serializer}) + except Exception as e: + return Response({"msg" : "This product is not found"}, status=status.HTTP_404_NOT_FOUND) + + + + diff --git a/eCommerce/db.sqlite3 b/eCommerce/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..f0e8aacfb1b8f5e2003433163152d72dc59ce2c7 GIT binary patch literal 147456 zcmeI5du$uYeaE?cEhUOv$&$Qx=Z995Wt)*@Enkx8i+iWDdA4d>zLV|V8OUL?Bvf7;j~sdhb-tucTC`2k04>_4C{Un9ilPY$q(vH_NFV6~ZGs}#rfE|&e;pDaNm1Yu zphbk-!l30lfTxB#_jexo0`El)&uK9N)l`L%3s-6MVJ?sB%9 zfv_O=v~o4%~DHPx5gj>>9kp_oc$@~Yi)x(E$#-+#Jn?Jl`PF@4vKbg2$Eq_W4N zq-kb4n#N&Ls8$+ArJ*$*Y#6jlCD+mm^F}()n#Q)1dbEk1s%_`Rq1(2m{l}Go$h;O2 zt?)!ehW)!fRt+%-p`yo|VVo~Euc zNy{tC*O!+rU%tsBbLYD{VYj9(?>3A6%7|~NVNsr)6&{Yd(6SNc0BT(iZHLiHen-Kx z=7|1Uh1vFr?6vm{i1NgQ@WH80WbMv3xDBK|(b>@J^?TJC>5+H!TH%&nJDEr>#@pSJ zbdr)@Z)m0Jx><=SMZIA(%(CH3H|tt`lXMK)Nn=XBS}i$KX)K)rZ2u|McF#Y%Nhxb) zjTE!JWlPA87Dib&OLj>M8M`Esp9*d0Yir#iNs3-*n0JXvw|-hw<(V1bwV$!;V^d_6vM+-@YG$Xt4b{sysz;jBeM_)& zgBEY=mGx@Jhc}nB`-fBe^Vy!6REL&$^P*prt0|%R3L9)aiqiCr4Xvc-jgnR-cOoTi zVLo3>6;pY38`2{~fWz!uQS>m}*|T*Q(jyzKds`D-STI@Swrbrc%BhsFwaHq%N6sEm z{?3-~VevM!e!_{I2)5PtZk2YOdMC%9^9E_xzRBvz=gYcrXVa(@4A-TvqkgW$lXMK8 zB01yDn}R6M%?Vq&lU>*2ychqSXcUV+ONS#S0PbW!aB9R&mc#cdj)eY;^g*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p2!H?xfB*Hd&L%R8rwWC$YdZbsRCVp_JtMynpWE2X&y|g$sm~SkhEBftevbdB#@t+TE-{x( zq!SCtR5C?=yy9L(D{P*=y|MmOVm^^fEhN*K)ak{nn)Q00ZoF~f563?6HG<)bR(%HC a^+|NrC-DxhkI(z`$I74k#rK{3&i?{BlqEp` literal 0 HcmV?d00001 diff --git a/eCommerce/eCommerce/__init__.py b/eCommerce/eCommerce/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/eCommerce/eCommerce/__pycache__/__init__.cpython-310.pyc b/eCommerce/eCommerce/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c6eaeb4d3620f1f92bec2577eb2ce32db56a223a GIT binary patch literal 205 zcmd1j<>g`kf?A0eNg(<$h(HF6K#l_t7qb9~6oz01O-8?!3`HPe1o5jtKeRZts8~NO zu_QA$F)=4Mu{a}B-z7h}G&eP`q*&i2D={xUUpJsAKPxpE#P@RabN7!Aat#iN_i=PG v!4yb!&d<$FElN(+N3i1KGxIV_;^XxSDsOSv#=VUZi literal 0 HcmV?d00001 diff --git a/eCommerce/eCommerce/__pycache__/settings.cpython-310.pyc b/eCommerce/eCommerce/__pycache__/settings.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d04fcc400ca1dd1d1f0948d8ae9290caf845e1d2 GIT binary patch literal 2358 zcmb7GTXWM!6qXeEf{8;&xD}=ybp{FsA~ypCrqiJ)mJ$rM<*{Va>H&?cUE3RUL%Sl4 zUi&wAXnE*Ne?|X?Ui;F%clyxjlpfhm;&GU1YFn$-xqRpBx96-JR;v{bK7U;KZSc!7 z$Nic=%zujT@B}XU6AXy6IK(5t<9)#rcn%AA>3jYM@keg2uvf5(Xvr!e(JGHP>&%El zg?GGFfqN0|XHm&oMxa3=%5{}@JmJyVx8jJms%Y6-K~=PZi|E`n4z0cw2ydN3=g}J2 zoJZ@E@xo-hNcfRxt)ffTd34!YgJ|n;T|if?i|8Zk61r+|wQJ5@p5rR&o)e5hiDJe` zFrv~hj3wL%eILgzmZCV^!!DC6l^q=5*kKq+g9GU%ns{wE$R~kBnG>^_1oiVT>gb0KD%o5(X0d*qA^-;^DgxA6LeVMfA&h9fdBHrx6b0yP;plK^@@g zER2Xt>xT)~r|@iyrD5WEl1C_$!r}3PoB%-}Ok(Mc<0Y8>pI9*-&IS4%HkYgMnb>vM zINh3YKmv;0B*q&z4%|mi4xG<|_|6yCZ|~QF8!tCs;^CWzWc(>}ACTnU=4KSTxA1i* zy7S=1*xfU0<@CZ7Ms~x1#bh8)C{5QFr3pm5wjj)1aKP9>glT$tK}j*CK=Vn34+>`l z9#_9eh9$?Zw z(xvwoW6ZLW=lqSSY|g88G6)oa9|m$>m|^fArZgVP4H#Y!ygz69a3L25IGxW!foGtT zxRd&vb6i}+A%pYI?J28sUJpL72#>h0_8j*Wbcp=TcFwLI<;_6n{8o;-PflWwru7*P z!+zvJ1IhyczyUgJ5m}w|qB&DjYi&{&-!U7S$Az@QnAXJf)*{SFD;eQIGD>fs!ZOCM zp_N#AXJ&g;y*Z~JK+d^N?=2V~@%RCULtRbGN?S_fxz?mz5 zE<@9&PZv_3)K2733f+NhI9Ldpgp>Oe#|q0kIbql!KJlEqC0|=TBJ4!h@bc^ z9E{lb*#GO(`cGS>JInDH;K^wLItjc3h+0#KWkZ96}6aycA2q4x%7#R$%ofLY}& z#nAG-&MJo1=xL_?T>CaFsM=P4C#x#0mcFa0_EX(3jcldaF-#DF01Cv&D($AKwzOTP zr)A4MT{rE1uhq~y+u0dYYj<0UsTtYouCde1?OV-;lGjppMpaBD4{Kysl)m}Y?ka|{ ztM^pS+2Na0jt;W&SFl-$habaV0ggU{LFAT~SC_<+xFibY tLiwy%5k!F(__83p7ylODi>pFO;ETNY56r6|6X&i!#dQ(P;ae;h{snBSDKY>6 literal 0 HcmV?d00001 diff --git a/eCommerce/eCommerce/__pycache__/urls.cpython-310.pyc b/eCommerce/eCommerce/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1a4b5f0d6280e7170df184548d6751cb12866335 GIT binary patch literal 1037 zcma)5&2AGh5cY01P1vTuBUs{)EK1jadWs4nq%9Ox1@-5W%hp*t$wq5?WqX08!Q+HtT}FafCeO>{$gj*TKUFq(k9tic`JYBkK3em38FTZJ^*wi7^5Abx_hD6&)`8;neO zg~H=cn3-H^5T2AgwdmGmUDBs991;RChZ!q`)B^~oQZUGF6I>Lvb1VK?9q%X`0$U8t zQ$u#%>vsD!ueo5f4>@M^dDq(AC>-Tjsr`u|Mz*s44~5WkDlL%M3AKUq#^iG7?}*06 z$5!l4N{lL~!*iwbV3oqtB@m1{x@)JvNs1A~>z39IWM9w(51o?2!TJI$cl-C`llCjv6C?m%UlR)OVK?QZq^Gm!Srx#LHU zt`(IEP0j2wjB|$7JVQq!Eg9unp(8i1`|sBSYwmA{=da%-7sr=Z$=UGL!M~2*zYG1b hEQYwat=fl7kTRz)JOe;=%n^XjgNI(H(ec_pe*uVCLJ$A| literal 0 HcmV?d00001 diff --git a/eCommerce/eCommerce/__pycache__/wsgi.cpython-310.pyc b/eCommerce/eCommerce/__pycache__/wsgi.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..970db9ceafada33fc8ac448462c4246bcd05190a GIT binary patch literal 612 zcmZWn!EO^V5cO`-rYsbpszMxnjYQWy^n?(ikProx6tSt0a@n}+*^MLHvsybTt;C5V zKLJNRiM?`xU*Lo{D@r6r^4R0i%zMvc+~1Fgw~vp0UVaV;`OyU1*7d=2zwEJhg3O2r zM5uyU;P;LSb!XNI2n5USmmSd+J6}T|bv}{Vt_Ty--@W-By-!ACnxV;ML36AqyhN>` z%7B&?E+KPq6pbB)4<%Z#)GdIvC0r?fsep1zIn^ju3XT-4LD4m@5G&9FK&sm ff2W3BTwd3EPul@K^M8oghDDd`-MJUu52Nr83T(eN literal 0 HcmV?d00001 diff --git a/eCommerce/eCommerce/asgi.py b/eCommerce/eCommerce/asgi.py new file mode 100644 index 00000000..534f83bb --- /dev/null +++ b/eCommerce/eCommerce/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for eCommerce 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/4.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eCommerce.settings') + +application = get_asgi_application() diff --git a/eCommerce/eCommerce/settings.py b/eCommerce/eCommerce/settings.py new file mode 100644 index 00000000..a466476d --- /dev/null +++ b/eCommerce/eCommerce/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for eCommerce project. + +Generated by 'django-admin startproject' using Django 4.0. + +For more information on this file, see +https://docs.djangoproject.com/en/4.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.0/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/4.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-%yc8@ya&nr+5$*w)n%^1^efv7ih!tc6iu311prc(e$ap+6%hcj' + +# 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', + 'brand', +] + +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 = 'eCommerce.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 = 'eCommerce.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/4.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': BASE_DIR / 'db.sqlite3', + } +} + + +# Password validation +# https://docs.djangoproject.com/en/4.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', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/4.0/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/4.0/howto/static-files/ + +STATIC_URL = 'static/' + +# Default primary key field type +# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/eCommerce/eCommerce/urls.py b/eCommerce/eCommerce/urls.py new file mode 100644 index 00000000..687ad1a5 --- /dev/null +++ b/eCommerce/eCommerce/urls.py @@ -0,0 +1,22 @@ +"""eCommerce URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.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 path, include + +urlpatterns = [ + path('admin/', admin.site.urls), + path('brands/', include("brand.urls")) +] diff --git a/eCommerce/eCommerce/wsgi.py b/eCommerce/eCommerce/wsgi.py new file mode 100644 index 00000000..18d60638 --- /dev/null +++ b/eCommerce/eCommerce/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for eCommerce 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/4.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eCommerce.settings') + +application = get_wsgi_application() diff --git a/eCommerce/manage.py b/eCommerce/manage.py new file mode 100755 index 00000000..aa3d79c9 --- /dev/null +++ b/eCommerce/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', 'eCommerce.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()