[GeoNode-devel] Patch metadata with geonode 4 (master)

Alessio Fabiani alessio.fabiani at geosolutionsgroup.com
Wed Dec 22 03:14:48 PST 2021


Dear Toni,
I could not find a suitable solution either yet, except overriding the
original templates.

Cheers,
Alessio.

On Wed, Dec 8, 2021 at 2:20 PM Toni Schönbuchner <
toni.schoenbuchner at csgis.de> wrote:

> Hi devs,
>
> I’m just testing the workshop docs for gn 4 (master branch).
> https://docs.geonode.org/en/master/devel/workshops/index.html
>
> One question regarding (the really usefuel) extending of metadata.
> In master it looks several fields have moved from resourceBase to Dataset
> Model.
> So let’s say we patch directly the Dataset Model in apps:
>
>  ….
> def patch_layers_dataset(self, cls):
> self._get_logger().info("Patching Dataset")
> animals_help_text = _('Your animals')
> animals = models.TextField(
> _('animals'),
> blank=True,
> null=True,
> help_text=animals_help_text)
> cls.add_to_class('animals', animals)
>
> ...
>
> def ready(self):
> super(AppConfig, self).ready()
> run_setup_hooks()
> ...
> from geonode.layers.models import Dataset
> self.patch_layers_dataset(Dataset)
>
>
> The new animals field now shows up in Django Admin and saves the data
> correctly.
> I would now expect to extend the metadata Wizard in
> /layers/templates/layouts/panels.html
> like:
>
>
> <span><label for="{{ dataset_form.animal|id }}">{{
> dataset_form.animals.label }}</label></span>
> {{ dataset_form.animals }}
>
> But the animals field is not populated (which in my opinion it should:
> https://github.com/GeoNode/geonode/blob/8b45f7d70a907764a99af9e99abfe7a9ea232a33/geonode/layers/forms.py#L45-L59
> )
>
>
> What do I miss that the dataset form respects the new field?
>
>
> Thanks,
>
> Toni
>
> _______________________________________________
> geonode-devel mailing list
> geonode-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geonode-devel
>


-- 

Regards,

Alessio Fabiani

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Ing. Alessio Fabiani

@alfa7691
Founder/Technical Lead


GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  333 8128928

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20211222/4d536342/attachment.html>


More information about the geonode-devel mailing list