[GeoNode-users] How to establish a relation between a layer and a document in the GeoNode database
eloi at openmailbox.org
Wed Mar 8 13:36:26 PST 2017
No bug here, it was my mistake deleting the layer of course the document loses the relationship with the layer because it is not there anymore.
But maybe the field object_id in documents_document should be SET NULL instead of NO ACTION, by the constraint and when the layer is deleted.
On 8 March 2017 20:45:30 CET, Paolo Corti <pcorti at gmail.com> wrote:
>Shouldn't we file a bug here and fix it in the code base?
>On Wed, Mar 8, 2017 at 8:09 AM, Eloi <eloi at openmailbox.org> wrote:
>> Thanks for your quick reply Simone.
>> It was very helpful. Now I can see in a SQL query how Documents and
>> SELECT d.resourcebase_ptr_id AS doc_id,
>> l.resourcebase_ptr_id AS lay_id,
>> d.title_en AS doc_title,
>> l.title_en AS lay_title
>> FROM documents_document AS d
>> LEFT JOIN layers_layer AS l ON l.resourcebase_ptr_id = d.object_id
>> ORDER BY l.title_en;
>> And I was wrong when I said "every time I run the command "python
>> updatelayers" all established relations (between a layers and a
>> disappear". That is not true, they did disappear because I have
>> layers in order to restore them again in the update. So my fault.
>> Thank you very much for the help.
>> On 2017-03-08 11:50, Simone Dalmasso wrote:
>>> The layers are actually saved in the layer_layer table but the
>>> in document_document and points to the ContentType model. It is a
>>> relation since it can point to any other geonode resource. The two
>>> that you have to compile in the document table are the contenty_type
>>> if the layer content type in your case) and object_id(the id of the
>>> Hope this helps
>>> 2017-03-08 10:05 GMT+01:00 Eloi <eloi at openmailbox.org>:
>>>> Good morning,
>>>> I would like to establish the relation between a layer and a
>>>> using the GeoNode database and not using the web interface.
>>>> I saw that the layers are listed in table 'base_resourcebase' and
>>>> documents in 'documents_document'. So I wonder in which table the
>>>> between the previous two is recorded. Then I would just run my SQL
>>>> define does relations.
>>>> Why I want to do this? Because every time I run the command "python
>>>> manage.py updatelayers" all established relations (between a layers
>>>> documents) disappear.
>>>> Thank you in advance!
>> geonode-users mailing list
>> geonode-users at lists.osgeo.org
>Geospatial software developer
>geonode-users mailing list
>geonode-users at lists.osgeo.org
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the geonode-users