Commits

Kai Diefenbach  committed c3a96a2

Added signal for shop changed

  • Participants
  • Parent commits 61a50b8

Comments (0)

Files changed (3)

File lfs/caching/listeners.py

 from lfs.core.signals import cart_changed
 from lfs.core.signals import product_changed
 from lfs.core.signals import category_changed
+from lfs.core.signals import shop_changed
 from lfs.core.signals import topseller_changed
 from lfs.marketing.models import Topseller
 from lfs.order.models import OrderItem
 # reviews imports
 from reviews.signals import review_added
 
+# Shop
+def shop_changed_listener(sender, **kwargs):
+    clear_cache()
+shop_changed.connect(shop_changed_listener)
+
 # Cart
 def cart_changed_listener(sender, **kwargs):
     update_cart_cache(sender)

File lfs/core/signals.py

 # django imports
 import django.dispatch
 
+# Shop
+shop_changed = django.dispatch.Signal()
+
 # Catalog
 cart_changed = django.dispatch.Signal()
 category_changed = django.dispatch.Signal()

File lfs/manage/views/shop.py

 import lfs.core.utils
 from lfs.caching.utils import lfs_get_object_or_404
 from lfs.core.models import Shop
+from lfs.core.signals import shop_changed
 from lfs.core.utils import LazyEncoder
 from lfs.core.widgets.image import LFSImageInput
 from lfs.manage.views.lfs_portlets import portlets_inline
     if request.method == "POST":
         form = ShopForm(instance=shop, data=request.POST, files=request.FILES)
         if form.is_valid():
-            form.save()
+            form.save()            
             return lfs.core.utils.set_message_cookie(
                 url = reverse("lfs_manage_shop"),
                 msg = _(u"Shop data has been saved."),
     form = ShopDefaultValuesForm(instance=shop, data=request.POST)
     
     if form.is_valid():
-        form.save()    
+        shop = form.save()
+        shop_changed.send(shop)
         message = _(u"Shop default values have been saved.")
     else:
         message = _(u"Please correct the indicated errors.")