<s> from __future__ import unicode_literals <EOL> from django . db import models <EOL> from django . utils . encoding import python_2_unicode_compatible <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from djangobmf . conf import settings <EOL> from djangobmf . models import BMFModel <EOL> from djangobmf . fields import CountryField <EOL> from . serializers import AddressSerializer <EOL> class BaseAddress ( BMFModel ) : <EOL> customer = models . ForeignKey ( <EOL> settings . CONTRIB_CUSTOMER , null = False , blank = False , <EOL> related_name = "<STR_LIT>" , on_delete = models . CASCADE , <EOL> ) <EOL> is_active = models . BooleanField ( _ ( '<STR_LIT>' ) , default = True ) <EOL> is_billing = models . BooleanField ( _ ( '<STR_LIT>' ) , default = True ) <EOL> is_shipping = models . BooleanField ( _ ( '<STR_LIT>' ) , default = True ) <EOL> default_billing = models . BooleanField ( _ ( '<STR_LIT>' ) , default = False ) <EOL> default_shipping = models . BooleanField ( _ ( '<STR_LIT>' ) , default = False ) <EOL> class Meta : <EOL> verbose_name = _ ( '<STR_LIT>' ) <EOL> verbose_name_plural = _ ( '<STR_LIT>' ) <EOL> ordering = [ '<STR_LIT:name>' ] <EOL> abstract = True <EOL> swappable = "<STR_LIT>" <EOL> def as_report ( self ) : <EOL> raise NotImplementedError ( <EOL> '<STR_LIT>' <EOL> ) <EOL> def bmfget_customer ( self ) : <EOL> return self . customer <EOL> @ python_2_unicode_compatible <EOL> class AbstractAddress ( BaseAddress ) : <EOL> """<STR_LIT:U+0020>""" <EOL> name = models . CharField ( _ ( '<STR_LIT:Name>' ) , max_length = <NUM_LIT:255> , null = True , blank = False , ) <EOL> name2 = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , null = True , blank = True , ) <EOL> street = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , null = True , blank = False , ) <EOL> zip = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , null = True , blank = False , ) <EOL> city = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , null = True , blank = False , ) <EOL> state = models . CharField ( _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , null = True , blank = True , ) <EOL> old_country = models . CharField ( <EOL> _ ( '<STR_LIT>' ) , max_length = <NUM_LIT:255> , null = True , blank = True , <EOL> help_text = "<STR_LIT>" <EOL> ) <EOL> country = CountryField ( _ ( '<STR_LIT>' ) ) <EOL> class Meta ( BaseAddress . Meta ) : <EOL> abstract = True <EOL> class BMFMeta : <EOL> observed_fields = [ '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:state>' , '<STR_LIT>' ] <EOL> serializer = AddressSerializer <EOL> def as_report ( self ) : <EOL> return _ ( <EOL> "<STR_LIT>" % { <EOL> '<STR_LIT:name>' : self . name , <EOL> '<STR_LIT>' : "<STR_LIT:\n>" + self . name2 , <EOL> '<STR_LIT>' : self . street , <EOL> '<STR_LIT>' : self . zip , <EOL> '<STR_LIT>' : self . city , <EOL> '<STR_LIT:state>' : self . state , <EOL> '<STR_LIT>' : self . country . alpha2 , <EOL> } <EOL> ) <EOL> def __str__ ( self ) : <EOL> name = self . name <EOL> if self . name2 : <EOL> name += "<STR_LIT:U+002CU+0020>" + self . name2 <EOL> return '<STR_LIT>' % ( <EOL> name , <EOL> self . street , <EOL> self . city , <EOL> self . country . alpha2 , <EOL> ) <EOL> class Address ( AbstractAddress ) : <EOL> pass </s>
