def save_models(self): # 保存数据对象 obj = self.new_obj obj.save() # 补充自定义行为 from celery_tasks.htmls.tasks import generate_static_sku_detail_html generate_static_sku_detail_html.delay(obj.sku.id)
def delete_model(self): # 删除数据对象 obj = self.obj sku_id = obj.sku.id obj.delete() # 补充自定义行为 from celery_tasks.htmls.tasks import generate_static_sku_detail_html generate_static_sku_detail_html.delay(sku_id)
def save_model(self, request, obj, form, change): obj.save() from celery_tasks.htmls.tasks import generate_static_sku_detail_html generate_static_sku_detail_html.delay(obj.sku.id) # 设置SKU默认图片 sku = obj.sku if not sku.default_image_url: sku.default_image_url = obj.image.url sku.save()
def save_model(self, request, obj, form, change): obj.save() from celery_tasks.htmls.tasks import generate_static_sku_detail_html generate_static_sku_detail_html.delay(obj.id)
def delete_model(self, request, obj): sku_id = obj.sku.id obj.delete() from celery_tasks.htmls.tasks import generate_static_sku_detail_html generate_static_sku_detail_html.delay(sku_id)