+class EntityOptions(object):
+ def __init__(self, options):
+ if options is not None:
+ for key, value in options.__dict__.items():
+ setattr(self, key, value)
+ if not hasattr(self, 'proxy_fields'):
+ self.proxy_fields = []
+
+ def add_proxy_field(self, proxy_field):
+ self.proxy_fields.append(proxy_field)
+
+
+class EntityBase(models.base.ModelBase):
+ def __new__(cls, name, bases, attrs):
+ new = super(EntityBase, cls).__new__(cls, name, bases, attrs)
+ entity_options = attrs.pop('EntityMeta', None)
+ setattr(new, '_entity_meta', EntityOptions(entity_options))
+ entity_class_prepared.send(sender=new)
+ return new
+
+