Пример #1
0
def start_default_listening():
    """Add required default listeners"""
    collect_urls.connect(add_download_urls, sender=product)
    product_signals.subtype_order_success.connect(create_download_link, sender=None)
    signals.order_success.connect(ship_downloadable_order, sender=None)

    log.debug('Added downnloadable product listeners')
Пример #2
0
def start_default_listening():
    """Add required default listeners"""
    collect_urls.connect(add_download_urls, sender=product)
    product_signals.subtype_order_success.connect(create_download_link,
                                                  sender=None)
    signals.order_success.connect(ship_downloadable_order, sender=None)

    log.debug('Added downnloadable product listeners')
Пример #3
0
    def set_details(self, raw):
        """Set the details from a raw list"""
        if raw:
            self._details = simplejson.dumps(raw)

    def get_details(self):
        """Convert the pickled details into a list"""
        if self._details:
            return simplejson.loads(self._details)
        else:
            return []

    details = property(fget=get_details, fset=set_details)

    def save(self, **kwargs):
        """Ensure we have a create_date before saving the first time."""
        if not self.pk:
            self.create_date = datetime.date.today()
        super(ProductWish, self).save(**kwargs)

    class Meta:
        verbose_name = _('Product Wish')
        verbose_name_plural = _('Product Wishes')


cart_add_view.connect(wishlist_cart_add_listener)

import config
from urls import add_wishlist_urls
collect_urls.connect(add_wishlist_urls, sender=shop)
Пример #4
0
Файл: models.py Проект: 34/T
    def set_details(self, raw):
        """Set the details from a raw list"""
        if raw:
            self._details = simplejson.dumps(raw)
    
    def get_details(self):
        """Convert the pickled details into a list"""
        if self._details:
            return simplejson.loads(self._details)
        else:
            return []

    details = property(fget=get_details, fset=set_details)

    def save(self, **kwargs):
        """Ensure we have a create_date before saving the first time."""
        if not self.pk:
            self.create_date = datetime.date.today()
        super(ProductWish, self).save(**kwargs)
        
    class Meta:
        verbose_name = _('Product Wish')
        verbose_name_plural = _('Product Wishes')

cart_add_view.connect(wishlist_cart_add_listener)

import config
from urls import add_wishlist_urls
collect_urls.connect(add_wishlist_urls, sender=shop)
Пример #5
0
def start_listening():
    from urls import add_newsletter_urls
    from satchmo_store import shop

    form_postsave.connect(contact_form_listener, sender=ContactInfoForm)
    collect_urls.connect(add_newsletter_urls, sender=shop)
Пример #6
0
def start_listening():
    from urls import add_newsletter_urls
    from satchmo_store import shop
    
    form_postsave.connect(contact_form_listener, sender=ContactInfoForm)
    collect_urls.connect(add_newsletter_urls, sender=shop)
Пример #7
0
                                    choices=settings.LANGUAGES)
    name = models.CharField(_('title'), max_length=100, blank=False)
    short_description = models.CharField(_('Short Description'),
                                         blank=True,
                                         max_length=200)
    description = models.TextField(_('Description'), blank=True)
    picture = ImageWithThumbnailField(
        verbose_name=_('Picture'),
        upload_to="__DYNAMIC__",
        name_field="_filename",
        null=True,
        blank=True,
        max_length=200)  #Media root is automatically prepended

    def _get_filename(self):
        if self.brandcategory:
            return '%s-%s' % (self.brandcategory.brand.slug, self.id)
        else:
            return 'default'

    _filename = property(_get_filename)

    class Meta:
        ordering = ('languagecode', )
        verbose_name_plural = _('Brand Category Translations')


#import config
from urls import add_brand_urls
collect_urls.connect(add_brand_urls, sender=product)
Пример #8
0
Файл: models.py Проект: 34/T
from django.contrib.comments.models import Comment
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from signals_ahoy.signals import collect_urls
import product
import satchmo_store

class ProductRating(models.Model):
    """A rating attached to a comment"""
    comment = models.OneToOneField(Comment, verbose_name="Rating", primary_key=True)
    rating = models.IntegerField(_("Rating"))

import config
from urls import add_product_urls, add_comment_urls
collect_urls.connect(add_product_urls, sender=product)
collect_urls.connect(add_comment_urls, sender=satchmo_store)
Пример #9
0
from signals_ahoy.signals import collect_urls
from satchmo_store import shop
from urls import add_feed_urls

collect_urls.connect(add_feed_urls, sender=shop)
Пример #10
0
Файл: models.py Проект: 34/T
        verbose_name = _('Brand Category Product')
        verbose_name_plural = _('Brand Category Products')

class BrandCategoryTranslation(models.Model):

    brandcategory = models.ForeignKey(BrandCategory, related_name="translations")
    languagecode = models.CharField(_('language'), max_length=10, choices=settings.LANGUAGES)
    name = models.CharField(_('title'), max_length=100, blank=False)
    short_description = models.CharField(_('Short Description'), blank=True, max_length=200)
    description = models.TextField(_('Description'), blank=True)
    picture = ImageWithThumbnailField(verbose_name=_('Picture'),
        upload_to="__DYNAMIC__",
        name_field="_filename",
        null=True, blank=True,
        max_length=200) #Media root is automatically prepended
    
    def _get_filename(self):
        if self.brandcategory:
            return '%s-%s' % (self.brandcategory.brand.slug, self.id)
        else:
            return 'default'
    _filename = property(_get_filename)
    
    class Meta:
        ordering=('languagecode', )
        verbose_name_plural = _('Brand Category Translations')

#import config        
from urls import add_brand_urls
collect_urls.connect(add_brand_urls, sender=product)
Пример #11
0
from satchmo_store.shop.signals import order_success, order_cancelled, satchmo_order_status_changed
from satchmo_store.accounts.signals import satchmo_registration
from satchmo_store.shop.models import Order
from satchmo_store.accounts.forms import RegistrationForm
from satchmo_store import shop
from signals_ahoy.signals import collect_urls

from reward.listeners import *
from reward.urls import add_reward_urls

log = logging.getLogger('rewards.listeners')

log.debug("Adding reward listeners")

satchmo_registration.connect(create_reward_listener, sender=None)
satchmo_order_status_changed.connect(rcv_order_status_changed, sender=None)
#order_cancelled.connect(remove_points, sender=None)
order_success.connect(add_points_on_order, sender=None)


collect_urls.connect(add_reward_urls, sender=shop)
Пример #12
0
config_group = 'PAYMENT_DUMB'

def add_dumb_urls(sender, patterns=None, **kwargs):
    """
    Payment in satchmo is unfriendly towards us; it only adds urls for modules
    with `PAYMENT_PROCESSOR` in their model.

    (See models.py on why we don't define `PAYMENT_PROCESSOR`.)
    """
    patterns.append(
        url(r'^checkout/%s/' % config_value(config_group, 'URL_BASE'),
            include('%s.urls' % config_value(config_group, 'MODULE').__name__),)
    )

collect_urls.connect(add_dumb_urls, sender=shop)

def add_dumb_method(sender, choices=None, **kwargs):
    """
    The `payment_choices` signal doesn't really allow us cover all the bases -
    `payment.active_gateways()` is the one to hack.

    But it's close.
    """
    if not choices:
        return

    module = config_value(config_group, 'MODULE')

    # repeat logic in `payment.config.labelled_gateway_choices()`
    defaultlabel = module.__name__.split('.')[-1]
Пример #13
0
from satchmo_store.shop.signals import order_success, order_cancelled, satchmo_order_status_changed
from satchmo_store.accounts.signals import satchmo_registration
from satchmo_store.shop.models import Order
from satchmo_store.accounts.forms import RegistrationForm
from satchmo_store import shop
from signals_ahoy.signals import collect_urls

from reward.listeners import *
from reward.urls import add_reward_urls

log = logging.getLogger('rewards.listeners')

log.debug("Adding reward listeners")

satchmo_registration.connect(create_reward_listener, sender=None)
satchmo_order_status_changed.connect(rcv_order_status_changed, sender=None)
#order_cancelled.connect(remove_points, sender=None)
order_success.connect(add_points_on_order, sender=None)

collect_urls.connect(add_reward_urls, sender=shop)
Пример #14
0
from django.contrib.comments.models import Comment
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
from signals_ahoy.signals import collect_urls
import product
import satchmo_store


class ProductRating(models.Model):
    """A rating attached to a comment"""
    comment = models.OneToOneField(Comment,
                                   verbose_name="Rating",
                                   primary_key=True)
    rating = models.IntegerField(_("Rating"))


import config
from urls import add_product_urls, add_comment_urls
collect_urls.connect(add_product_urls, sender=product)
collect_urls.connect(add_comment_urls, sender=satchmo_store)