feat: ruff'ed
This commit is contained in:
+22
-89
@@ -24,123 +24,71 @@ from shop.models import (
|
||||
# Register your models here.
|
||||
@admin.register(Product)
|
||||
class ProductAdmin(ModelAdmin):
|
||||
search_fields = ("name",)
|
||||
list_display = (
|
||||
"id",
|
||||
"name",
|
||||
"stock",
|
||||
)
|
||||
search_fields = ('name',)
|
||||
list_display = ('id', 'name', 'stock')
|
||||
|
||||
|
||||
@admin.register(ProductPrice)
|
||||
class ProductPriceAdmin(ModelAdmin):
|
||||
search_fields = ("product",)
|
||||
autocomplete_fields = ("product",)
|
||||
list_display = (
|
||||
"id",
|
||||
"product",
|
||||
"price",
|
||||
"date",
|
||||
"tax",
|
||||
)
|
||||
search_fields = ('product',)
|
||||
autocomplete_fields = ('product',)
|
||||
list_display = ('id', 'product', 'price', 'date', 'tax')
|
||||
|
||||
|
||||
@admin.register(Tax)
|
||||
class TaxAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"code",
|
||||
"value",
|
||||
)
|
||||
list_display = ('code', 'value')
|
||||
|
||||
|
||||
@admin.register(OrderLine)
|
||||
class OrderLineAdmin(ModelAdmin):
|
||||
autocomplete_fields = ("product",)
|
||||
list_display = (
|
||||
"id",
|
||||
"product",
|
||||
"price",
|
||||
"quantity",
|
||||
)
|
||||
autocomplete_fields = ('product',)
|
||||
list_display = ('id', 'product', 'price', 'quantity')
|
||||
|
||||
|
||||
@admin.register(Order)
|
||||
class OrderAdmin(ModelAdmin):
|
||||
list_display = ("id",)
|
||||
list_display = ('id',)
|
||||
|
||||
|
||||
@admin.register(Provider)
|
||||
class ProviderAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"vat_id",
|
||||
"name",
|
||||
)
|
||||
list_display = ('vat_id', 'name')
|
||||
|
||||
|
||||
@admin.register(Tag)
|
||||
class TagAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"name",
|
||||
)
|
||||
list_display = ('id', 'name')
|
||||
|
||||
|
||||
@admin.register(Brand)
|
||||
class BrandAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"name",
|
||||
)
|
||||
list_display = ('id', 'name')
|
||||
|
||||
|
||||
@admin.register(ProductBatch)
|
||||
class ProductBatchAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"product",
|
||||
"quantity",
|
||||
"provider",
|
||||
)
|
||||
list_display = ('id', 'product', 'quantity', 'provider')
|
||||
|
||||
|
||||
@admin.register(Cart)
|
||||
class ProductBatchAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"uuid",
|
||||
"user",
|
||||
"creation_date",
|
||||
)
|
||||
class CartAdmin(ModelAdmin):
|
||||
list_display = ('uuid', 'user', 'creation_date')
|
||||
|
||||
|
||||
@admin.register(CartItem)
|
||||
class ProductBatchAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"cart",
|
||||
"product",
|
||||
"quantity",
|
||||
)
|
||||
class CartItemAdmin(ModelAdmin):
|
||||
list_display = ('id', 'cart', 'product', 'quantity')
|
||||
|
||||
|
||||
@admin.register(ShippingMethod)
|
||||
class ShippingMethodAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
)
|
||||
list_display = ('id', 'name', 'description')
|
||||
|
||||
|
||||
@admin.register(CustomerAddress)
|
||||
class CustomerAddressAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"user",
|
||||
"vat_id",
|
||||
"address",
|
||||
"address_state",
|
||||
"address_zip",
|
||||
)
|
||||
list_display = ('id', 'user', 'vat_id', 'address', 'address_state', 'address_zip')
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super().get_queryset(request)
|
||||
@@ -149,29 +97,14 @@ class CustomerAddressAdmin(ModelAdmin):
|
||||
|
||||
@admin.register(ProductCategory)
|
||||
class ProductCategoryAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"name",
|
||||
"parent",
|
||||
"promoted",
|
||||
"hidden",
|
||||
"show_in_navbar",
|
||||
)
|
||||
list_display = ('id', 'name', 'parent', 'promoted', 'hidden', 'show_in_navbar')
|
||||
|
||||
|
||||
@admin.register(ShopSettings)
|
||||
class ShopSettingsAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"merchant_code",
|
||||
"currency_code",
|
||||
"terminal",
|
||||
)
|
||||
list_display = ('id', 'merchant_code', 'currency_code', 'terminal')
|
||||
|
||||
|
||||
@admin.register(ProductImage)
|
||||
class ProductImageAdmin(ModelAdmin):
|
||||
list_display = (
|
||||
"id",
|
||||
"original",
|
||||
)
|
||||
list_display = ('id', 'original')
|
||||
|
||||
Reference in New Issue
Block a user