delete mathod qoshildi
This commit is contained in:
@@ -6,6 +6,7 @@ from core.apps.api.models import CategoryModel, FilialModel, SubcategoryModel
|
|||||||
class SubcategoryInline(TabularInline):
|
class SubcategoryInline(TabularInline):
|
||||||
model = SubcategoryModel
|
model = SubcategoryModel
|
||||||
extra = 1
|
extra = 1
|
||||||
|
autocomplete_fields = ("category",)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(FilialModel)
|
@admin.register(FilialModel)
|
||||||
@@ -19,16 +20,18 @@ class FilialAdmin(ModelAdmin):
|
|||||||
class CategoryAdmin(ModelAdmin):
|
class CategoryAdmin(ModelAdmin):
|
||||||
list_display = ("id", "name", "filial", "order", "image", "active_image", "created_at")
|
list_display = ("id", "name", "filial", "order", "image", "active_image", "created_at")
|
||||||
list_editable = ("order",)
|
list_editable = ("order",)
|
||||||
list_filter = ("filial", "created_at")
|
list_filter = ("filial", "type", "created_at")
|
||||||
search_fields = ("name",)
|
search_fields = ("name", "filial__name", "type")
|
||||||
list_select_related = ("filial",)
|
list_select_related = ("filial",)
|
||||||
ordering = ("order",)
|
ordering = ("order",)
|
||||||
|
autocomplete_fields = ("filial",)
|
||||||
inlines = [SubcategoryInline]
|
inlines = [SubcategoryInline]
|
||||||
|
|
||||||
|
|
||||||
@admin.register(SubcategoryModel)
|
@admin.register(SubcategoryModel)
|
||||||
class SubcategoryAdmin(ModelAdmin):
|
class SubcategoryAdmin(ModelAdmin):
|
||||||
list_display = ("id", "name", "category", "created_at")
|
list_display = ("id", "name", "category", "created_at")
|
||||||
list_filter = ("category", "category__filial", "created_at")
|
list_filter = ("category__filial", "category", "created_at")
|
||||||
search_fields = ("name", "category__name")
|
search_fields = ("name", "category__name", "category__filial__name")
|
||||||
list_select_related = ("category",)
|
list_select_related = ("category", "category__filial")
|
||||||
|
autocomplete_fields = ("category",)
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ class SubProductInline(TabularInline):
|
|||||||
@admin.register(ProductsModel)
|
@admin.register(ProductsModel)
|
||||||
class ProductsAdmin(ModelAdmin):
|
class ProductsAdmin(ModelAdmin):
|
||||||
list_display = ("id", "name", "price", "image", "subcategory", "created_at")
|
list_display = ("id", "name", "price", "image", "subcategory", "created_at")
|
||||||
list_filter = ("subcategory", "subcategory__category", "subcategory__category__filial", "created_at")
|
list_filter = ("subcategory__category__filial", "subcategory__category", "subcategory", "created_at")
|
||||||
search_fields = ("name", "subcategory__name")
|
search_fields = ("name", "subcategory__name", "subcategory__category__name")
|
||||||
list_select_related = ("subcategory", "subcategory__category")
|
list_select_related = ("subcategory", "subcategory__category", "subcategory__category__filial")
|
||||||
|
autocomplete_fields = ("subcategory",)
|
||||||
inlines = [SubProductInline]
|
inlines = [SubProductInline]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ class CategoryModel(AbstractBaseModel):
|
|||||||
order = models.PositiveIntegerField(verbose_name=_("order"), default=0)
|
order = models.PositiveIntegerField(verbose_name=_("order"), default=0)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.name} ({self.type})"
|
filial_name = self.filial.name if self.filial else "Filial yo'q"
|
||||||
|
return f"{self.name} ({self.type}) - {filial_name}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _baker(cls):
|
def _baker(cls):
|
||||||
|
|||||||
Reference in New Issue
Block a user