viur-framework / viur-core

The core component of ViUR, the Python framework for modern web development.
https://www.viur.dev
MIT License
13 stars 14 forks source link

feat: Make SkeletonInstance json serializable #1262

Closed ArneGudermann closed 2 months ago

ArneGudermann commented 2 months ago

This PR is a fix for #1092 and makes SkeletonInstances now json serializable. Like:

def get_skel():
    skel = conf.main_app.country.viewSkel()
    skel.fromDB("agxoaWVyLWdpYnQtZXNyFQsSDm5pY2h0c196dXNlaGVuGLkKDA")
    return skel

foo=JsonBone(compute=Compute(fn=get_skel,interval=ComputeInterval(ComputeMethod.OnWrite),raw=True))

Now get in json render

"c_s": {
               "key": "agxoaWVyLWdpYnQtZXNyFQsSDm5pY2h0c196dXNlaGVuGLkKDA",
                "name": null,
                "creationdate": "2022-10-05T06:20:38+00:00",
                "changedate": "2024-02-05T13:20:46+00:00",
                "viurCurrentSeoKeys": {
                    "de": "4757066702913536",
                    "_viurLanguageWrapper_": true,
                    "en": "4757066702913536"
                },
                "country": "Nauru",
                "continent": "Oceania",
                "sortindex": 1664950838.329367
            }