<s> from __future__ import unicode_literals <EOL> from six import with_metaclass <EOL> from django . db import models <EOL> from django . core . exceptions import ImproperlyConfigured <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from . order import BaseOrder , BaseOrderItem , OrderItemModel <EOL> from . import deferred <EOL> class BaseDelivery ( with_metaclass ( deferred . ForeignKeyBuilder , models . Model ) ) : <EOL> """<STR_LIT>""" <EOL> order = deferred . ForeignKey ( BaseOrder ) <EOL> shipping_id = models . CharField ( _ ( "<STR_LIT>" ) , max_length = <NUM_LIT:255> , null = True , blank = True , <EOL> help_text = _ ( "<STR_LIT>" ) ) <EOL> fulfilled_at = models . DateTimeField ( _ ( "<STR_LIT>" ) , null = True , blank = True ) <EOL> shipped_at = models . DateTimeField ( _ ( "<STR_LIT>" ) , null = True , blank = True ) <EOL> shipping_method = models . CharField ( _ ( "<STR_LIT>" ) , max_length = <NUM_LIT:50> , <EOL> help_text = _ ( "<STR_LIT>" ) ) <EOL> class Meta : <EOL> abstract = True <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) <EOL> @ classmethod <EOL> def perform_model_checks ( cls ) : <EOL> canceled_field = [ f for f in OrderItemModel . _meta . fields if f . attname == '<STR_LIT>' ] <EOL> if not canceled_field or canceled_field [ <NUM_LIT:0> ] . get_internal_type ( ) != '<STR_LIT>' : <EOL> msg = "<STR_LIT>" <EOL> raise ImproperlyConfigured ( msg . format ( OrderItemModel . __name__ ) ) <EOL> DeliveryModel = deferred . MaterializedModel ( BaseDelivery ) <EOL> class BaseDeliveryItem ( with_metaclass ( deferred . ForeignKeyBuilder , models . Model ) ) : <EOL> """<STR_LIT>""" <EOL> delivery = deferred . ForeignKey ( BaseDelivery , verbose_name = _ ( "<STR_LIT>" ) , <EOL> help_text = _ ( "<STR_LIT>" ) ) <EOL> item = deferred . ForeignKey ( BaseOrderItem , verbose_name = _ ( "<STR_LIT>" ) ) <EOL> class Meta : <EOL> abstract = True <EOL> verbose_name = _ ( "<STR_LIT>" ) <EOL> verbose_name_plural = _ ( "<STR_LIT>" ) <EOL> @ classmethod <EOL> def perform_model_checks ( cls ) : <EOL> try : <EOL> order_field = [ f for f in OrderItemModel . _meta . fields if f . attname == '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> deliver_field = [ f for f in cls . _meta . fields if f . attname == '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> if order_field . get_internal_type ( ) != deliver_field . get_internal_type ( ) : <EOL> msg = "<STR_LIT>" <EOL> raise ImproperlyConfigured ( msg . format ( cls . __name__ , OrderItemModel . __name__ ) ) <EOL> except IndexError : <EOL> msg = "<STR_LIT>" <EOL> raise ImproperlyConfigured ( msg . format ( cls . __name__ ) ) <EOL> DeliveryItemModel = deferred . MaterializedModel ( BaseDeliveryItem ) </s>
