[Qgis-user] changed relationship behaviour between qgis 2.x and 3.x?

Janneke van Dijk janneke.qgis at gmail.com
Thu Mar 18 07:48:35 PDT 2021


Dear all,

As a learning experience I am trying to make an application that was 
developed with python 2 and qgis 2 with a postgres backend of vs 9.3 
work with python 3/qgis 3/postgres 13.

As expected, there are plenty of places where it is still not working as 
it should, but I have managed to upgrade the database, open the project 
file in qgis 3.16, and all the layers (based on views) have loaded 
correctly. The relationships that were stored in the project file also 
seem to be working correctly with the existing .ui files. I can open the 
parent layer form, and in the child form I can see the foreign key 
reflected properly, and changing as the selected parent feature is 
changed. All the relationship settings were set manually and stored in 
the project file. When I change the column preview on the left hand side 
of the form from parentid to any other column, the child form still 
shows the parentid correctly.

For testing/learning purposed I did the whole process manually from 
scratch in 3.16. When I now open the parent layer form, and set the 
column preview on the left of the form to anything else than the 
parentid, in the child form, where I would have expected the parentid as 
before, it shows the column used in the column preview.

Is this the expected behaviour? Is it possible to set this to the 'old' 
behavior? If so, can that also be done using python (ultimately I want 
to load the layers and create the relationships in python)? Below some 
screenshots to clarify what I described.

Thanks for your help,

Janneke

Original situation (A), behaviour as expected:

A) With locationid as column preview shows corresponding locationid in 
child form (the number 1)

The same when changing the column preview: (now locationid in child form 
is number 11288)

B) Manually newly created relationships, with column preview of the 
parent id shows it in the child form (note that there seems to be a box 
in front of another box, in another situation I have seen it looking 
like a greyed out combo box)

With the newly created relationship, when selecting districtid as a 
column preview, it is the district id that is shown in the child form, 
not the locationid.






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apelhpkagegeajil.png
Type: image/png
Size: 1431 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kmchimehpdfpmecm.png
Type: image/png
Size: 1948 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jgmkfkidljilhogl.png
Type: image/png
Size: 1685 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mdehikbabchijdpi.png
Type: image/png
Size: 2186 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ladoccedhikpfdpj.png
Type: image/png
Size: 1452 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0012.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pjhfegcammngfeoe.png
Type: image/png
Size: 2366 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0013.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fioobeefgglohhda.png
Type: image/png
Size: 1659 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0014.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cklhlflhecagflfb.png
Type: image/png
Size: 2558 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210318/6a08f85b/attachment-0015.png>


More information about the Qgis-user mailing list