def product_feed(request, category=None, template="product_feeds/googlebase_atom.xml", content_type="application/atom+xml"): """Build a feed of all active products. """ shop_config = Config.objects.get_current() if category: try: cat = Category.objects.active().get(slug=category) products = cat.active_products() except Category.DoesNotExist: raise Http404(_("Bad Category: %s" % category)) else: cat = None products = Product.objects.active_by_site() products = filter(lambda product:"ConfigurableProduct" not in product.get_subtypes(), products) params = {} view = 'satchmo_atom_feed' if category: params['category'] = category view = 'satchmo_atom_category_feed' url = shop_config.base_url + reverse(view, None, params) payment_choices = [c[1] for c in credit_choices(None, True)] return render_to_response(template, { 'products' : products, 'category' : cat, 'url' : url, 'shop' : shop_config, 'payments' : payment_choices, 'date' : timezone.now(), }, content_type=content_type)
def product_feed(request, category=None, template="product_feeds/googlebase_atom.xml", mimetype="application/atom+xml"): """Build a feed of all active products. """ shop_config = Config.objects.get_current() if category: try: cat = Category.objects.active().get(slug=category) products = cat.active_products() except Category.DoesNotExist: raise Http404, _("Bad Category: %s" % category) else: cat = None products = Product.objects.active_by_site() products = filter(lambda product:"ConfigurableProduct" not in product.get_subtypes(), products) params = {} view = 'satchmo_atom_feed' if category: params['category'] = category view = 'satchmo_atom_category_feed' url = shop_config.base_url + urlresolvers.reverse(view, None, params) payment_choices = [c[1] for c in credit_choices(None, True)] return render_to_response(template, { 'products' : products, 'category' : cat, 'url' : url, 'shop' : shop_config, 'payments' : payment_choices, 'date' : timezone.now(), }, mimetype=mimetype)
def __init__(self, choices="__DYNAMIC__", *args, **kwargs): if choices == "__DYNAMIC__": kwargs['choices'] = credit_choices() super(CreditChoiceCharField, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): choices = kwargs.pop("choices", "__DYNAMIC__") if choices == "__DYNAMIC__": kwargs['choices'] = credit_choices() super(CreditChoiceCharField, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): super(CreditCardDetailAdminForm, self).__init__(*args, **kwargs) self.fields['credit_type'].choices = credit_choices()