Пример #1
0
    def _create_instance(self):
        model_fields = {
            'age': fields.IntegerField(),
            'name': fields.StringField(),
            'number': fields.StringField()
        }

        model_content = {'age': 5, 'name': "Jack", 'number': "12345678"}

        instance = ModelInstance(model_name="Contact",
                                 model_fields=model_fields,
                                 model_content=model_content)

        return instance
Пример #2
0
class RandomModel(model.Model):

    time = fields.DateTimeField()
    id_field = fields.StringField(primary=True)
    number = fields.IntegerField(default=0)
    obj = fields.ObjectField(Car)
    json_field = fields.JSONField()
Пример #3
0
class Message(model.Model):
    message_id = fields.StringField(primary=True)
    content = fields.StringField()
    created = fields.DateTimeField()
Пример #4
0
class Recipient(model.Model):
    recipient_id = fields.StringField(primary=True)
    contact = fields.ForeignKey(Contact)
    message = fields.ForeignKey(Message)
Пример #5
0
class Contact(model.Model):
    model_name = "Contact"

    contact_id = fields.StringField(primary=True)
    name = fields.StringField()
    age = fields.IntegerField(default=0)