teksi / district_heating

Future TEKSI distance heating module
GNU General Public License v3.0
0 stars 0 forks source link

Missing attribute of superclass in subclasses #12

Closed sjib closed 1 month ago

sjib commented 1 month ago

This needs two views in the datamodel that connect sub and superclass of e.g. pipe_point_normal and pipe_point.

vw_pipe_point_normal
vw_pipe_point_feed

This will be created with the following code in [datamodel/app/create_app.py](https://github.com/teksi/district_heating/pull/1/files#diff-602f10e24baf8ee8a6cf8bb49fab65d122013435be9b5704ab0192e9a5020099)

SingleInheritances = {

pipe_point (Leitungspunkt)

    "pipe_point_normal": "pipe_point",
    "pipe_point_feed": "pipe_point",
}

for key in SingleInheritances:
    SingleInheritance(
        "tdh_od." + SingleInheritances[key],
        "tdh_od." + key,
        view_name="vw_" + key,
        pkey_default_value=True,
        inner_defaults={"identifier": "obj_id"},
        **defaults,
    ).create()
sjib commented 1 month ago

@jpdupuy Temporarely I can provide you the two sql create statements here: create_tdh_app.vw_pipe_point_views.zip

But they will not adapt to any model changes automatically like this. But you can use them for setting up your test environment and have a view instead of classes to base your forms on. That is also how it will work like later (similar to the implementation of TEKSI wastewater)

jpdupuy commented 1 month ago

@sjib Thank you for the temporary fix. It will be nice to have the full fix for the editing in QGIS

jpdupuy commented 1 month ago

@sjib I fixed a syntax error tdh_od instead of tww_od create_tdh_app.vw_pipe_point_views.zip