class Delivery(mongodb.EmbeddedDocument): date = mongodb.DateTimeField(required=True) impressions = mongodb.IntField(required=True) embed_dt = mongodb.DateTimeField(default=datetime.now()) embed_update_dt = mongodb.DateTimeField(default=datetime.now()) def __repr__(self): return '<Delivery: {0}>'.format(self.date)
class PlacementPeriod(mongodb.EmbeddedDocument): start = mongodb.DateTimeField(required=True) end = mongodb.DateTimeField(required=True) cpm = mongodb.IntField(required=True) budget = mongodb.IntField(required=True) delivery = mongodb.EmbeddedDocumentListField(Delivery) embed_dt = mongodb.DateTimeField(default=datetime.now()) embed_update_dt = mongodb.DateTimeField(default=datetime.now()) def __repr__(self): return '<PlacementPeriod: {0} - {1}>'.format(self.start, self.end)
class Placement(mongodb.Document): placement_id = mongodb.IntField(required=True, unique=True) name = mongodb.StringField(required=True) placement_period = mongodb.EmbeddedDocumentListField(PlacementPeriod) created_dt = mongodb.DateTimeField(default=datetime.now()) updated_dt = mongodb.DateTimeField(default=datetime.now()) # Allow document to be inherited for dynamic models. meta = { 'allow_inheritance': True, } def __repr__(self): return '<Placement: {0} {1}>'.format(self.placement_id, self.name)
class Shift(mongodb.Document): shift_id = mongodb.UUIDField(required=True, unique=False) description = mongodb.StringField() address = mongodb.StringField(required=True) city = mongodb.StringField(required=True) state = mongodb.StringField(required=True) postal_code = mongodb.StringField(required=True) country = mongodb.StringField(required=True) time_slots = mongodb.EmbeddedDocumentListField(TimeSlots) labels = mongodb.ListField(mongodb.StringField()) created_dt = mongodb.DateTimeField(default=datetime.now()) updated_dt = mongodb.DateTimeField(default=datetime.now()) # Allow document to be inherited for dynamic models. meta = {'allow_inheritance': True}
class TimeSlots(mongodb.EmbeddedDocument): label = mongodb.StringField() start = mongodb.DateTimeField(required=True) end = mongodb.DateTimeField(required=True)