Skip to content

Commit

Permalink
fix: fixing update gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
roniahmadi committed Feb 29, 2024
1 parent e030713 commit 726548e
Show file tree
Hide file tree
Showing 101 changed files with 109 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
*node_modules
mysql
.env
**/__pycache__/
**/__pycache__
Binary file removed apidata/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed apidata/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file removed apidata/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file removed apidata/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file modified apidata/serializers/__pycache__/auth_serializer.cpython-311.pyc
Binary file not shown.
Binary file modified apidata/serializers/__pycache__/produks_serializer.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file modified apidata/serializers/__pycache__/stores_serializer.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file modified apidata/viewsets/__pycache__/auth_viewset.cpython-311.pyc
Binary file not shown.
Binary file modified apidata/viewsets/__pycache__/produks_viewset.cpython-311.pyc
Binary file not shown.
Binary file modified apidata/viewsets/__pycache__/slides_viewset.cpython-311.pyc
Binary file not shown.
Binary file modified apidata/viewsets/__pycache__/stores_viewset.cpython-311.pyc
Binary file not shown.
Binary file modified apidata/viewsets/__pycache__/ulasan_viewset.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/serializers.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/view_helper.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/views.cpython-311.pyc
Binary file not shown.
Binary file removed frontend/__pycache__/viewsets.cpython-311.pyc
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/base_view.cpython-311.pyc
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/detail_view.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/home.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/koleksi_view.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/masuk_view.cpython-311.pyc
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/produk_view.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/splash.cpython-311.pyc
Binary file not shown.
Binary file modified frontend/function_view/__pycache__/toko_view.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions frontend/function_view/dropzone_upload_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .base_view import FrontPage
from django.http import JsonResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt


@method_decorator(csrf_exempt, name="dispatch")
class UploadDropzone(FrontPage):
def get(self, request):
return JsonResponse({"status": True, "uuid": "1"})
96 changes: 96 additions & 0 deletions frontend/function_view/jual_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
from django.urls import reverse
from django.shortcuts import redirect, render
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from .base_view import FrontPage
from store.models import UserStore
from produk.models import (
Kategori,
WarnaProduk,
TipeProduk,
Expedisi,
GambarProduk,
Produk
)


@method_decorator(csrf_exempt, name="dispatch")
@method_decorator(login_required(login_url="/profile"), name="dispatch")
class Jual(FrontPage):
def get(self, request):
user = UserStore.objects.filter(users_id=request.user.id)
if user.exists():
user = user.first()
if user.is_active_store is False:
return redirect(reverse("profile"))
kategori = Kategori.objects.all()
typeproduk = TipeProduk.objects.all()
warnaproduk = WarnaProduk.objects.all()
expedisi = Expedisi.objects.all()
return render(
request,
"jualpage.html",
{
"kategori": kategori,
"typeproduk": typeproduk,
"warnaproduk": warnaproduk,
"ekspedisi": expedisi,
},
)

def post(self, request):
refinput = request.POST
reffile = request.FILES
store = None
try:
store = UserStore.objects.get(users__pk=request.user.id)
except Exception as e:
print(e)
store = UserStore.objects.create(
users=request.user, nama=request.user.username
)

try:
produk = Produk.objects.get(
store__id=store.id, nama=refinput.get("nama", "")
)
messages.error(request, "Produk sudah ada")
except Exception as e:
print(e)
produk = Produk.objects.create(
store=store,
nama=refinput.get("nama", ""),
harga=refinput.get("harga", 1),
detail=refinput.get("deskripsi", "-"),
stok_produk=refinput.get("stok", 1),
berat=refinput.get("berat"),
lebar=refinput.get("lebar"),
cross_boarder=refinput.get("lintas_negara", False),
)
for k in refinput.getlist("kategori"):
kateg = Kategori.objects.filter(pk=k).first()
produk.kategori.add(kateg)

for k in refinput.getlist("warna"):
try:
warnaa = WarnaProduk.objects.filter(pk=k).first()
except Exception as e:
print(e)
warnaa = WarnaProduk.objects.filter(nama=k).first()
if warnaa:
produk.warna.add(warnaa)
else:
warnaa = WarnaProduk.objects.create(nama=k)
produk.warna.add(warnaa)

tipes = TipeProduk.objects.filter(pk=refinput.get("tipe")).first()
produk.tipe.add(tipes)
# print(reffile.get("gambar"))
for reffiles in reffile.getlist("gambar"):
GambarProduk.objects.create(
produk=produk, nama=refinput.get("nama", "-"), gambar=reffiles
)
messages.success(request, "Produk Berhasil disimpan")
return redirect(reverse("jual"))
Binary file modified frontend/migrations/__pycache__/0001_initial.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified frontend/templatetags/__pycache__/translater.cpython-311.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions frontend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
from .function_view.withdrawl_proccess_view import WithdrawlProcess
from .function_view.withdrawl_request_json_view import WithdrawlRequestJson
from .function_view.withdrawl_view import Withdrawl
from .function_view.jual_view import Jual
from .function_view.dropzone_upload_view import UploadDropzone
from .views import (
AboutApp,
AddToCart,
Expand All @@ -75,7 +77,6 @@
EditBarang,
Faq,
GetData,
Jual,
MinusPluss,
PaymentsCart,
PrivacyAndPolicy,
Expand All @@ -88,7 +89,6 @@
TransaksiToko,
TransaksiUserSelesaiJson,
Tutorial,
UploadDropzone,
WithdrawlToko,
WithdrawlTokoJson,
)
Expand Down
86 changes: 0 additions & 86 deletions frontend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,92 +35,6 @@
# from passkeys.models import UserPasskey


@method_decorator(csrf_exempt, name="dispatch")
class UploadDropzone(FrontPage):
def get(self, request):
return JsonResponse({"status": True, "uuid": "1"})


@method_decorator(csrf_exempt, name="dispatch")
@method_decorator(login_required(login_url="/profile"), name="dispatch")
class Jual(FrontPage):
def get(self, request):
user = UserStore.objects.filter(users_id=request.user.id)
if user.exists():
user = user.first()
if user.is_active_store is False:
return redirect("/profile")
kategori = Kategori.objects.all()
typeproduk = TipeProduk.objects.all()
warnaproduk = WarnaProduk.objects.all()
expedisi = Expedisi.objects.all()
return render(
request,
"jualpage.html",
{
"kategori": kategori,
"typeproduk": typeproduk,
"warnaproduk": warnaproduk,
"ekspedisi": expedisi,
},
)

def post(self, request):
refinput = request.POST
reffile = request.FILES
store = None
try:
store = UserStore.objects.get(users__pk=request.user.id)
except Exception as e:
print(e)
store = UserStore.objects.create(
users=request.user, nama=request.user.username
)

try:
produk = Produk.objects.get(
store__id=store.id, nama=refinput.get("nama", "")
)
messages.error(request, "Produk sudah ada")
except Exception as e:
print(e)
produk = Produk.objects.create(
store=store,
nama=refinput.get("nama", ""),
harga=refinput.get("harga", 1),
detail=refinput.get("deskripsi", "-"),
stok_produk=refinput.get("stok", 1),
berat=refinput.get("berat"),
lebar=refinput.get("lebar"),
cross_boarder=refinput.get("lintas_negara", False),
)
for k in refinput.getlist("kategori"):
kateg = Kategori.objects.filter(pk=k).first()
produk.kategori.add(kateg)

for k in refinput.getlist("warna"):
try:
warnaa = WarnaProduk.objects.filter(pk=k).first()
except Exception as e:
print(e)
warnaa = WarnaProduk.objects.filter(nama=k).first()
if warnaa:
produk.warna.add(warnaa)
else:
warnaa = WarnaProduk.objects.create(nama=k)
produk.warna.add(warnaa)

tipes = TipeProduk.objects.filter(pk=refinput.get("tipe")).first()
produk.tipe.add(tipes)
# print(reffile.get("gambar"))
for reffiles in reffile.getlist("gambar"):
GambarProduk.objects.create(
produk=produk, nama=refinput.get("nama", "-"), gambar=reffiles
)
messages.success(request, "Produk Berhasil disimpan")
return redirect("/jual/")


@method_decorator(csrf_exempt, name="dispatch")
class DetailProfileAddressMain(FrontPage):
def post(self, request, id):
Expand Down
Binary file removed master/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed master/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file removed master/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file removed master/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified master/migrations/__pycache__/0001_initial.cpython-311.pyc
Binary file not shown.
Binary file removed produk/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed produk/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file removed produk/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file removed produk/__pycache__/forms.cpython-311.pyc
Binary file not shown.
Binary file removed produk/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified produk/migrations/__pycache__/0001_initial.cpython-311.pyc
Binary file not shown.
Binary file modified produk/migrations/__pycache__/0002_initial.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed profiles/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed profiles/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file removed profiles/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file removed profiles/__pycache__/managers.cpython-311.pyc
Binary file not shown.
Binary file removed profiles/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified profiles/migrations/__pycache__/0001_initial.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified profiles/migrations/__pycache__/0004_langsupport.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed projekpi/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed projekpi/__pycache__/celery.cpython-311.pyc
Binary file not shown.
Binary file removed projekpi/__pycache__/pi_network.cpython-311.pyc
Binary file not shown.
Binary file removed projekpi/__pycache__/settings.cpython-311.pyc
Binary file not shown.
Binary file removed projekpi/__pycache__/urls.cpython-311.pyc
Binary file not shown.
Binary file removed projekpi/__pycache__/wsgi.cpython-311.pyc
Binary file not shown.
Binary file removed store/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed store/__pycache__/admin.cpython-311.pyc
Binary file not shown.
Binary file removed store/__pycache__/apps.cpython-311.pyc
Binary file not shown.
Binary file removed store/__pycache__/forms.cpython-311.pyc
Binary file not shown.
Binary file removed store/__pycache__/models.cpython-311.pyc
Binary file not shown.
Binary file modified store/migrations/__pycache__/0001_initial.cpython-311.pyc
Binary file not shown.
Binary file modified store/migrations/__pycache__/0002_expedisi.cpython-311.pyc
Binary file not shown.
Binary file removed theme/__pycache__/__init__.cpython-311.pyc
Binary file not shown.
Binary file removed theme/__pycache__/apps.cpython-311.pyc
Binary file not shown.

0 comments on commit 726548e

Please sign in to comment.