Code source de ref_geo.schemas

from marshmallow_sqlalchemy.fields import Nested

from utils_flask_sqla.schema import SmartRelationshipsMixin
from utils_flask_sqla_geo.schema import GeoAlchemyAutoSchema

from ref_geo.env import db, ma
from ref_geo.models import BibAreasTypes, LAreas, LiMunicipalities


[docs] class AreaTypeSchema(SmartRelationshipsMixin, ma.SQLAlchemyAutoSchema):
[docs] class Meta:
[docs] model = BibAreasTypes
[docs] include_fk = True
[docs] load_instance = True
[docs] class AreaSchema(SmartRelationshipsMixin, GeoAlchemyAutoSchema):
[docs] class Meta:
[docs] model = LAreas
[docs] include_fk = True
[docs] load_instance = True
[docs] feature_geometry = "geom_4326"
[docs] area_type = Nested(AreaTypeSchema)
[docs] class MunicipalitySchema(SmartRelationshipsMixin, GeoAlchemyAutoSchema):
[docs] class Meta:
[docs] model = LiMunicipalities
[docs] include_fk = True
[docs] load_instance = True