<s> from sellmo . apps . pricing import PriceField <EOL> from sellmo . core . loading import load <EOL> from django . db import models <EOL> from django . contrib . sites . models import Site <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> import polymorphism <EOL> import sellmo . contrib . shipping as _shipping <EOL> @ load ( action = '<STR_LIT>' ) <EOL> def finalize_model ( ) : <EOL> class ShippingMethod ( _shipping . models . ShippingMethod ) : <EOL> objects = _shipping . models . ShipmentManager . from_queryset ( <EOL> _shipping . models . ShipmentQuerySet ) ( ) <EOL> class Meta ( _shipping . models . ShippingMethod . Meta ) : <EOL> app_label = '<STR_LIT>' <EOL> _shipping . models . ShippingMethod = ShippingMethod <EOL> class ShippingMethodQuerySet ( models . QuerySet ) : <EOL> pass <EOL> class ShippingMethodManager ( models . Manager ) : <EOL> pass <EOL> class ShippingMethod ( polymorphism . PolymorphicModel ) : <EOL> active = models . BooleanField ( default = True , verbose_name = _ ( "<STR_LIT>" ) ) <EOL> identifier = models . CharField ( <EOL> unique = True , <EOL> db_index = True , <EOL> max_length = <NUM_LIT:20> , <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> ) <EOL> name = models . CharField ( max_length = <NUM_LIT> , verbose_name = _ ( "<STR_LIT:name>" ) ) <EOL> carriers = models . ManyToManyField ( <EOL> '<STR_LIT>' , <EOL> blank = True , <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> ) <EOL> def get_methods ( self ) : <EOL> if self . carriers . count ( ) == <NUM_LIT:0> : <EOL> yield self . get_method ( ) <EOL> else : <EOL> for carrier in self . carriers . all ( ) : <EOL> yield self . get_method ( carrier ) <EOL> def get_method ( self , carrier = None ) : <EOL> from . method import ShippingMethod <EOL> return ShippingMethod ( self . identifier , self . name , carrier = carrier ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Meta : <EOL> abstract = True <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) <EOL> @ load ( action = '<STR_LIT>' ) <EOL> def finalize_model ( ) : <EOL> class ShippingCarrier ( _shipping . models . ShippingCarrier ) : <EOL> objects = _shipping . models . ShipmentManager . from_queryset ( <EOL> _shipping . models . ShipmentQuerySet ) ( ) <EOL> class Meta ( _shipping . models . ShippingCarrier . Meta ) : <EOL> app_label = '<STR_LIT>' <EOL> _shipping . models . ShippingCarrier = ShippingCarrier <EOL> class ShippingCarrierQuerySet ( models . QuerySet ) : <EOL> pass <EOL> class ShippingCarrierManager ( models . Manager ) : <EOL> pass <EOL> class ShippingCarrier ( models . Model ) : <EOL> active = models . BooleanField ( default = True , verbose_name = _ ( "<STR_LIT>" ) ) <EOL> identifier = models . CharField ( <EOL> unique = True , <EOL> db_index = True , <EOL> max_length = <NUM_LIT:20> , <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> ) <EOL> name = models . CharField ( max_length = <NUM_LIT> , verbose_name = _ ( "<STR_LIT:name>" ) ) <EOL> extra_costs = PriceField ( <EOL> multi_currency = True , <EOL> components = None , <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> ) <EOL> def __unicode__ ( self ) : <EOL> return self . name <EOL> class Meta : <EOL> abstract = True <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) <EOL> @ load ( action = '<STR_LIT>' ) <EOL> def finalize_model ( ) : <EOL> class Shipment ( _shipping . models . Shipment ) : <EOL> objects = _shipping . models . ShipmentManager . from_queryset ( <EOL> _shipping . models . ShipmentQuerySet ) ( ) <EOL> class Meta ( _shipping . models . Shipment . Meta ) : <EOL> app_label = '<STR_LIT>' <EOL> _shipping . models . Shipment = Shipment <EOL> class ShipmentQuerySet ( polymorphism . PolymorphicQuerySet ) : <EOL> pass <EOL> class ShipmentManager ( polymorphism . PolymorphicManager ) : <EOL> pass <EOL> class Shipment ( polymorphism . PolymorphicModel ) : <EOL> order = polymorphism . PolymorphicOneToOneField ( <EOL> '<STR_LIT>' , <EOL> null = True , <EOL> related_name = '<STR_LIT>' , <EOL> polymorphic_related = True , <EOL> editable = False <EOL> ) <EOL> method_string = models . CharField ( <EOL> max_length = <NUM_LIT> , <EOL> editable = False ) <EOL> description = models . CharField ( <EOL> max_length = <NUM_LIT:255> , <EOL> verbose_name = _ ( "<STR_LIT:description>" ) <EOL> ) <EOL> costs = PriceField ( default = <NUM_LIT:0> , verbose_name = _ ( "<STR_LIT>" ) ) <EOL> def resolve_method ( self ) : <EOL> return NotImplemented <EOL> def __unicode__ ( self ) : <EOL> return self . description <EOL> class Meta : <EOL> abstract = True <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) </s>
