Features: None;
Fixes: None; Extra: 1) Remove unnecessary blank line in `CategoryDetailListSerializer`; 2) Simplify queryset methods in `core/admin.py` by restructuring `.select_related` calls;
This commit is contained in:
parent
bccf67970f
commit
8d2ce5b013
2 changed files with 2 additions and 11 deletions
|
|
@ -146,11 +146,7 @@ class AttributeValueInline(TabularInline): # type: ignore [type-arg]
|
||||||
icon = "fa-solid fa-list-ul"
|
icon = "fa-solid fa-list-ul"
|
||||||
|
|
||||||
def get_queryset(self, request):
|
def get_queryset(self, request):
|
||||||
return (
|
return super().get_queryset(request).select_related("attribute", "product")
|
||||||
super()
|
|
||||||
.get_queryset(request)
|
|
||||||
.select_related("attribute", "product")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ProductImageInline(TabularInline): # type: ignore [type-arg]
|
class ProductImageInline(TabularInline): # type: ignore [type-arg]
|
||||||
|
|
@ -174,11 +170,7 @@ class StockInline(TabularInline): # type: ignore [type-arg]
|
||||||
icon = "fa-solid fa-boxes-stacked"
|
icon = "fa-solid fa-boxes-stacked"
|
||||||
|
|
||||||
def get_queryset(self, request):
|
def get_queryset(self, request):
|
||||||
return (
|
return super().get_queryset(request).select_related("vendor", "product")
|
||||||
super()
|
|
||||||
.get_queryset(request)
|
|
||||||
.select_related("vendor", "product")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class OrderProductInline(TabularInline): # type: ignore [type-arg]
|
class OrderProductInline(TabularInline): # type: ignore [type-arg]
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ class AttributeGroupDetailSerializer(ModelSerializer):
|
||||||
|
|
||||||
|
|
||||||
class CategoryDetailListSerializer(ListSerializer):
|
class CategoryDetailListSerializer(ListSerializer):
|
||||||
|
|
||||||
def to_representation(self, data): # type: ignore[override]
|
def to_representation(self, data): # type: ignore[override]
|
||||||
items = list(data)
|
items = list(data)
|
||||||
with suppress(Exception):
|
with suppress(Exception):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue