[GeoNode-devel] set default layer category
Toni Schönbuchner
toni.schoenbuchner at csgis.de
Thu Mar 19 04:56:23 PDT 2020
Hi Oliver,
I do not know of a settings variable to do so. Most likely It's needed to add this functionality
yourself. GeoNode project allows you to easily override some view. Hence you could try
to extend the layer_upload method
https://github.com/GeoNode/geonode/blob/master/geonode/layers/views.py#L208 <https://github.com/GeoNode/geonode/blob/master/geonode/layers/views.py#L208>
and before saving set some category. Untested code just to show you what I mean:
from geonode.base.models import TopicCategory
topics = TopicCategory.objects.all()
layer_cat = topics.get(identifier='social')
layer.category = layer_cat
layer.save()
Hope this helps,
Cheers,
Toni
> Am 18.03.2020 um 20:00 schrieb geonode-devel-request at lists.osgeo.org:
>
> Von: EFTAS Oliver Buck <oliver.buck at eftas.com <mailto:oliver.buck at eftas.com>>
> Betreff: [GeoNode-devel] set default layer category
> Datum: 18. März 2020 um 09:28:14 MEZ
> An: "geonode-devel at lists.osgeo.org <mailto:geonode-devel at lists.osgeo.org>" <geonode-devel at lists.osgeo.org <mailto:geonode-devel at lists.osgeo.org>>
>
>
> Dear all,
>
> we would like to set a default category for a new layer upload. Is this fesaible.
>
> If a new vector layer is uploaded, it should per default (changeable of course by the user, if he/she wishes) be set to a default category.
>
> Any hints how to set this?
>
> Thanks
> oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20200319/657fc533/attachment-0001.html>
More information about the geonode-devel
mailing list