首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >django-shop跳过送货

django-shop跳过送货
EN

Stack Overflow用户
提问于 2013-04-16 16:41:12
回答 1查看 435关注 0票数 1

我正在使用django-shop,我不知道如何跳过送货,因为我不需要它。我尝试了几种方法,但没有发现任何问题。

有人有主意了吗?

我试图复制flate_rate发货来做我自己的,但我面临着一个没有反向匹配的问题。

这是我的文件:

代码语言:javascript
复制
# -*- coding: utf-8 -*-
from decimal import Decimal
from django.conf.urls import patterns, url
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext_lazy as _
from shop.util.decorators import on_method, shop_login_required, order_required


class PostShipping(object):
"""
This is just an example of a possible flat-rate shipping module, that
charges a flat rate defined in settings.SHOP_SHIPPING_FLAT_RATE
"""
    url_namespace = 'post'
    backend_name = 'La Poste'
    backend_verbose_name = _('La Poste')

    def __init__(self, shop):
        self.shop = shop  # This is the shop reference, it allows this backend
        # to interact with it in a tidy way (look ma', no imports!)
        self.rate = 0

@on_method(shop_login_required)
@on_method(order_required)
def view_process_order(self, request):
    """
    A simple (not class-based) view to process an order.

    This will be called by the selection view (from the template) to do the
    actual processing of the order (the previous view displayed a summary).

    It calls shop.finished() to go to the next step in the checkout
    process.
    """
    self.shop.add_shipping_costs(self.shop.get_order(request),
                                 'la poste',
                                 Decimal(self.rate))
    return self.shop.finished(self.shop.get_order(request))
    # That's an HttpResponseRedirect

@on_method(shop_login_required)
@on_method(order_required)
def view_display_fees(self, request):
    """
    A simple, normal view that displays a template showing how much the
    shipping will be (it's an example, alright)
    """
    ctx = {}
    ctx.update({'shipping_costs': Decimal(self.rate)})
    return render_to_response('shop/shipping/flat_rate/display_fees.html',
        ctx, context_instance=RequestContext(request))

def get_urls(self):
    urlpatterns = patterns('',
        url(r'^$', self.view_display_fees, name='flat'),
        url(r'^process/$', self.view_process_order, name='flat_process'),
    )
    return urlpatterns
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-16 16:48:16

看一眼github repo,似乎没有设置禁用发货。但是,您可以定义自己的发货后端以自定义内容(使发货静默通过)。

如果您只是在销售数字产品,我建议您编写自己的代码,it's not that hard.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16032431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档