Module kibicara.platforms.test.model

Expand source code
# Copyright (C) 2020 by Thomas Lindner <tom@dl6tom.de>
#
# SPDX-License-Identifier: 0BSD

from kibicara.model import Hood, Mapping
from ormantic import Integer, ForeignKey, Model


class Test(Model):
    id: Integer(primary_key=True) = None
    hood: ForeignKey(Hood)

    class Mapping(Mapping):
        table_name = 'testapi'

Classes

class Test (**data)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class Test(Model):
    id: Integer(primary_key=True) = None
    hood: ForeignKey(Hood)

    class Mapping(Mapping):
        table_name = 'testapi'

Ancestors

  • ormantic.models.Model
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Class variables

var Mapping
var hood : ormantic.fields.ForeignKey
var id : ormantic.fields.Integer

Instance variables

var objects
Expand source code
def __get__(self, instance, owner):
    return self.__class__(model_cls=owner)