Example #1
0
        class CustomModel(model.Model):
            datetime = fields.DateTime(auto_now_on_create=True)

            class Meta:
                collection = 'test'
Example #2
0
        class CustomModel(model.Model):
            name = fields.String()
            dt = fields.DateTime()

            class Meta:
                collection = 'test'
Example #3
0
    async def test_db_deserialize(self):
        field = fields.DateTime()
        dt = datetime.datetime(2015, 7, 13)

        self.assertEqual(dt, await field.db_deserialize(dt))
Example #4
0
    async def test_on_create__without_auto(self):
        field = fields.DateTime()

        self.assertEqual(await field.on_create(None), None)
Example #5
0
    async def test_on_create(self):
        field = fields.DateTime(auto_now_on_create=True)

        self.assertIsInstance(await field.on_create(None), datetime.datetime)
Example #6
0
    async def test_on_save__without_auto(self):
        field = fields.DateTime()

        self.assertEqual(None, await field.on_save(None))