From 99ef6c99627c865e7ba4679fce6d622689fe023c Mon Sep 17 00:00:00 2001 From: Roni Ahmadi Date: Sun, 6 Oct 2024 00:33:39 +0700 Subject: [PATCH] fixing lint ruff --- frontend/urls.py | 1 - master/admin_view/distric.py | 1 - master/admin_view/provinsi.py | 1 - master/admin_view/regency.py | 1 - master/admin_view/region.py | 2 +- master/admin_view/subregion.py | 2 +- master/admin_view/village.py | 2 +- master/models/configuration_website.py | 2 +- master/models/expedisi.py | 1 - master/utils.py | 2 +- transaction/models.py | 57 ++++++++++++++++++++------ transaction/tests.py | 1 - transaction/utils.py | 2 +- transaction/views.py | 1 - 14 files changed, 51 insertions(+), 25 deletions(-) diff --git a/frontend/urls.py b/frontend/urls.py index 0ffc3be..ef0093b 100644 --- a/frontend/urls.py +++ b/frontend/urls.py @@ -139,7 +139,6 @@ ), path("toko//transaksi/", TransaksiToko.as_view(), name="transaksi_toko"), path("toko/transaksi//report", ReportToko.as_view(), name="toko_laporkan"), - # user path("user/withdrawl/", Withdrawl.as_view(), name="withdrawl"), path( diff --git a/master/admin_view/distric.py b/master/admin_view/distric.py index f871598..6523366 100644 --- a/master/admin_view/distric.py +++ b/master/admin_view/distric.py @@ -20,4 +20,3 @@ class Meta: class DistricAdmin(ImportExportModelAdmin): resource_classes = [DistricResource] - diff --git a/master/admin_view/provinsi.py b/master/admin_view/provinsi.py index ced2408..0bada28 100644 --- a/master/admin_view/provinsi.py +++ b/master/admin_view/provinsi.py @@ -12,4 +12,3 @@ class Meta: class ProvinsiAdmin(ImportExportModelAdmin): resource_classes = [ProvinsiResource] - diff --git a/master/admin_view/regency.py b/master/admin_view/regency.py index f4140bd..d29edf8 100644 --- a/master/admin_view/regency.py +++ b/master/admin_view/regency.py @@ -20,4 +20,3 @@ class Meta: class RegencyAdmin(ImportExportModelAdmin): resource_classes = [RegencyResource] - diff --git a/master/admin_view/region.py b/master/admin_view/region.py index ecc0fd2..77d2ffe 100644 --- a/master/admin_view/region.py +++ b/master/admin_view/region.py @@ -13,4 +13,4 @@ class Meta: class RegionAdmin(ImportExportModelAdmin): - resource_classes = [RegionResource] \ No newline at end of file + resource_classes = [RegionResource] diff --git a/master/admin_view/subregion.py b/master/admin_view/subregion.py index 86c3bef..38d6ba5 100644 --- a/master/admin_view/subregion.py +++ b/master/admin_view/subregion.py @@ -19,4 +19,4 @@ class Meta: class SubRegionAdmin(ImportExportModelAdmin): - resource_classes = [SubRegionResource] \ No newline at end of file + resource_classes = [SubRegionResource] diff --git a/master/admin_view/village.py b/master/admin_view/village.py index 987a36b..2c2cb0b 100644 --- a/master/admin_view/village.py +++ b/master/admin_view/village.py @@ -19,4 +19,4 @@ class Meta: class VillageAdmin(ImportExportModelAdmin): - resource_classes = [VillageResource] \ No newline at end of file + resource_classes = [VillageResource] diff --git a/master/models/configuration_website.py b/master/models/configuration_website.py index 735b905..522f955 100644 --- a/master/models/configuration_website.py +++ b/master/models/configuration_website.py @@ -15,4 +15,4 @@ class ConfigurationWebsite(SingletonModel): api_biteship = models.CharField(blank=True, null=True, max_length=255) verification = models.CharField(blank=True, null=True, max_length=255) - bypass_expedisi = models.BooleanField(default=False) \ No newline at end of file + bypass_expedisi = models.BooleanField(default=False) diff --git a/master/models/expedisi.py b/master/models/expedisi.py index aaf40ba..87cd55d 100644 --- a/master/models/expedisi.py +++ b/master/models/expedisi.py @@ -10,4 +10,3 @@ class Expedisi(models.Model): def __str__(self): return self.nama - diff --git a/master/utils.py b/master/utils.py index 249c2f8..4c21882 100644 --- a/master/utils.py +++ b/master/utils.py @@ -1,4 +1,4 @@ SOURCE_REQUEST = [ (1, "Raja Ongkir"), (2, "Biteship"), -] \ No newline at end of file +] diff --git a/transaction/models.py b/transaction/models.py index b22dc78..dac256f 100644 --- a/transaction/models.py +++ b/transaction/models.py @@ -13,9 +13,12 @@ from transaction.utils import TYPE, TYPE_CART_ITEM, STATUS, STATUS_TOKO from master.utils import SOURCE_REQUEST + # Creating Backup User class TransactionUser(models.Model): - user = models.ForeignKey(UserProfile, null=True, on_delete=models.SET_NULL, related_name="transaction_origin_user_cart") + user = models.ForeignKey( + UserProfile, null=True, on_delete=models.SET_NULL, related_name="transaction_origin_user_cart" + ) first_name = models.CharField(max_length=255, blank=True, null=True) last_name = models.CharField(max_length=255, blank=True, null=True) image_profile = models.ImageField(upload_to="transaction_profile_img/", blank=True, null=True) @@ -32,8 +35,12 @@ class TransactionUser(models.Model): # Creating Backup Store class TransactionUserStore(models.Model): - store = models.ForeignKey(UserStore, on_delete=models.SET_NULL, null=True, related_name="transaction_transactionuserstore_store") - users = models.ForeignKey(TransactionUser, on_delete=models.SET_NULL, null=True, related_name="transaction_user_store") + store = models.ForeignKey( + UserStore, on_delete=models.SET_NULL, null=True, related_name="transaction_transactionuserstore_store" + ) + users = models.ForeignKey( + TransactionUser, on_delete=models.SET_NULL, null=True, related_name="transaction_user_store" + ) nama = models.TextField(null=False, blank=False) coin = models.FloatField(default=0) deskripsi = models.TextField(null=True, blank=True) @@ -49,7 +56,13 @@ def __str__(self) -> str: # Creating Addres for user class AddressUserChart(models.Model): - user = models.ForeignKey(TransactionUser, on_delete=models.CASCADE, null=True, blank=True, related_name="transaction_addressuserchart_user") + user = models.ForeignKey( + TransactionUser, + on_delete=models.CASCADE, + null=True, + blank=True, + related_name="transaction_addressuserchart_user", + ) typeaddress = models.IntegerField(choices=TYPE_CART_ITEM, default=1) name = models.CharField(max_length=255) @@ -66,7 +79,7 @@ class AddressUserChart(models.Model): def __str__(self): return self.address - + # Creating Backup Produk Katgori class CartProdukKategori(models.Model): @@ -76,7 +89,7 @@ class CartProdukKategori(models.Model): def __str__(self) -> str: return self.kode - + class CartProdukTipe(models.Model): nama = models.CharField(blank=True, null=True, max_length=255) @@ -93,15 +106,21 @@ def __str__(self): class CartProduk(models.Model): - store = models.ForeignKey(TransactionUserStore, null=True, on_delete=models.SET_NULL, related_name="transaction_cartproduk_store") - produk = models.ForeignKey(Produk, null=True, on_delete=models.SET_NULL, related_name="transaction_cartproduk_produk") + store = models.ForeignKey( + TransactionUserStore, null=True, on_delete=models.SET_NULL, related_name="transaction_cartproduk_store" + ) + produk = models.ForeignKey( + Produk, null=True, on_delete=models.SET_NULL, related_name="transaction_cartproduk_produk" + ) nama = models.TextField(null=True, blank=True) harga = models.FloatField(null=True, blank=True) kategori = models.ManyToManyField(CartProdukKategori) detail = models.TextField(null=True, blank=True) - tipe = models.ForeignKey(CartProdukTipe, blank=True, null=True, on_delete=models.SET_NULL, related_name="transaction_cartproduk_tipe") + tipe = models.ForeignKey( + CartProdukTipe, blank=True, null=True, on_delete=models.SET_NULL, related_name="transaction_cartproduk_tipe" + ) warna = models.ManyToManyField(CartProdukWarna, blank=True, null=True, related_name="transaction_cartproduk_warna") stok_produk = models.IntegerField(default=0) is_active = models.BooleanField(default=True) @@ -169,9 +188,23 @@ class CartItem(models.Model): unique_cart = models.CharField(max_length=50, blank=True, null=True) cart = models.ForeignKey(Cart, on_delete=models.SET_NULL, null=True, related_name="transaction_cartitem_cart") jumlah = models.IntegerField(default=1) - produk = models.ForeignKey(CartProduk, null=True, on_delete=models.SET_NULL, related_name="transaction_cartitem_produk") - user_chart = models.ForeignKey(TransactionUser, blank=True, null=True, on_delete=models.SET_NULL, related_name="transaction_cartitem_user_chart") - store_chart = models.ForeignKey(TransactionUserStore, blank=True, null=True, on_delete=models.SET_NULL, related_name="transaction_cartitem_store_chart") + produk = models.ForeignKey( + CartProduk, null=True, on_delete=models.SET_NULL, related_name="transaction_cartitem_produk" + ) + user_chart = models.ForeignKey( + TransactionUser, + blank=True, + null=True, + on_delete=models.SET_NULL, + related_name="transaction_cartitem_user_chart", + ) + store_chart = models.ForeignKey( + TransactionUserStore, + blank=True, + null=True, + on_delete=models.SET_NULL, + related_name="transaction_cartitem_store_chart", + ) def __str__(self): return " cart " + self.unique_cart diff --git a/transaction/tests.py b/transaction/tests.py index 4929020..a39b155 100644 --- a/transaction/tests.py +++ b/transaction/tests.py @@ -1,2 +1 @@ - # Create your tests here. diff --git a/transaction/utils.py b/transaction/utils.py index 37d6e34..25d691f 100644 --- a/transaction/utils.py +++ b/transaction/utils.py @@ -9,4 +9,4 @@ ] STATUS = [(1, "Pending"), (2, "Diproses"), (3, "Selesai"), (4, "Confirm")] -STATUS_TOKO = [(1, "Pending"), (2, "Diproses"), (3, "Dikirim"), (4, "Confirm")] \ No newline at end of file +STATUS_TOKO = [(1, "Pending"), (2, "Diproses"), (3, "Dikirim"), (4, "Confirm")] diff --git a/transaction/views.py b/transaction/views.py index b8e4ee0..60f00ef 100644 --- a/transaction/views.py +++ b/transaction/views.py @@ -1,2 +1 @@ - # Create your views here.