udpate product detail name filed

This commit is contained in:
Parsa Nazer
2025-04-22 03:09:07 +03:30
parent 5d17038f9b
commit 044bed9c00
4 changed files with 29 additions and 4 deletions
+3 -3
View File
@@ -1,4 +1,5 @@
from django.contrib import admin, messages
from product.tasks import update_prices
from .models import *
from unfold.admin import TabularInline, StackedInline
from home.models import LearnVideoModel
@@ -122,7 +123,7 @@ class DetailModelAdmin(ModelAdmin, ImportExportModelAdmin):
class ProductDetailModel1Admin(ModelAdmin, ImportExportModelAdmin):
import_form_class = ImportForm
export_form_class = ExportForm
search_fields = ['detail_category__title']
search_fields = ['detail_category__title', 'name']
compressed_fields = True
warn_unsaved_form = True
@@ -216,8 +217,7 @@ class ProductModelAdmin(ModelAdmin, ImportExportModelAdmin):
@action(description=f"اپدیت قیمت ها")
def update_products_price(self, request):
print('from the button')
ProductVariant.update_all_prices()
# update_prices()
messages.success(request, f"قیمت {ProductVariant.objects.all().count()} تنوع محصول اپدیت شد")
return redirect("admin:product_productmodel_changelist")