udpate product detail name filed
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user