예제 #1
0
파일: placement.py 프로젝트: dtrodger/ad
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)
예제 #2
0
파일: placement.py 프로젝트: dtrodger/ad
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)
예제 #3
0
파일: placement.py 프로젝트: dtrodger/ad
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)
예제 #4
0
파일: shift.py 프로젝트: dtrodger/shift
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}
예제 #5
0
파일: shift.py 프로젝트: dtrodger/shift
class TimeSlots(mongodb.EmbeddedDocument):
    label = mongodb.StringField()
    start = mongodb.DateTimeField(required=True)
    end = mongodb.DateTimeField(required=True)