<s> from sellmo . core . loading import load <EOL> from sellmo . contrib . discount . constants import APPLIES_TO_CHOICES <EOL> from django . db import models <EOL> from django . db . models import Q <EOL> from django . contrib . sites . models import Site <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> import polymorphism <EOL> import sellmo . contrib . discount as _discount <EOL> import sellmo . apps . product as _product <EOL> @ load ( action = '<STR_LIT>' ) <EOL> def finalize_model ( ) : <EOL> class Discount ( _discount . models . Discount ) : <EOL> objects = ( <EOL> _discount . models . DiscountManager . from_queryset ( <EOL> _discount . models . DiscountQuerySet <EOL> ) <EOL> ) ( ) <EOL> class Meta ( _discount . models . Discount . Meta ) : <EOL> app_label = '<STR_LIT>' <EOL> _discount . models . Discount = Discount <EOL> @ load ( after = '<STR_LIT>' ) <EOL> @ load ( before = '<STR_LIT>' ) <EOL> def load_model ( ) : <EOL> class DiscountQuerySet ( <EOL> _discount . models . DiscountQuerySet , <EOL> _product . models . ProductRelatableQuerySet <EOL> ) : <EOL> pass <EOL> class DiscountManager ( <EOL> _discount . models . DiscountManager , <EOL> _product . models . ProductRelatableManager <EOL> ) : <EOL> pass <EOL> class Discount ( <EOL> _discount . models . Discount , _product . models . ProductRelatable <EOL> ) : <EOL> class Meta ( <EOL> _discount . models . Discount . Meta , <EOL> _product . models . ProductRelatable . Meta <EOL> ) : <EOL> abstract = True <EOL> _discount . models . Discount = Discount <EOL> _discount . models . DiscountQuerySet = DiscountQuerySet <EOL> _discount . models . DiscountManager = DiscountManager <EOL> class DiscountQuerySet ( polymorphism . PolymorphicQuerySet ) : <EOL> pass <EOL> class DiscountManager ( polymorphism . PolymorphicManager ) : <EOL> def get_by_natural_key ( self , name ) : <EOL> return self . get ( name = name ) <EOL> class Discount ( polymorphism . PolymorphicModel ) : <EOL> SUBTYPES = [ ] <EOL> name = models . CharField ( max_length = <NUM_LIT> , verbose_name = _ ( "<STR_LIT:name>" ) , unique = True ) <EOL> customer_groups = models . ManyToManyField ( <EOL> '<STR_LIT>' , <EOL> blank = True , <EOL> related_name = '<STR_LIT>' , <EOL> ) <EOL> applies_to = models . CharField ( <EOL> max_length = <NUM_LIT:30> , <EOL> choices = APPLIES_TO_CHOICES , <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> ) <EOL> active = models . BooleanField ( default = True , verbose_name = _ ( "<STR_LIT>" ) ) <EOL> valid_from = models . DateField ( <EOL> null = True , <EOL> blank = True , <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> ) <EOL> valid_to = models . DateField ( <EOL> null = True , <EOL> blank = True , <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> ) <EOL> def natural_key ( self ) : <EOL> return ( self . name , ) <EOL> def apply ( self , price ) : <EOL> raise NotImplementedError ( ) <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>" ) </s>
