Coverage for /home/tribaal/workspace/django-shop/shop/shipping/backends/flat_rate : 77.27%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
""" This is just an example of a possible flat-rate shipping module, that charges a flat rate defined in settings.SHOP_SHIPPING_FLAT_RATE """
# to interact with it in a tidy way (look ma', no imports!)
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), 'Flat shipping', Decimal(self.rate)) return self.shop.finished(self.shop.get_order(request)) # That's an HttpResponseRedirect
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))
""" Return the list of URLs defined here. """ url(r'^$', self.view_display_fees, name='flat'), url(r'^process/$', self.view_process_order, name='flat_process'), ) |