<div dir="ltr">Dear Toni,<div>I could not find a suitable solution either yet, except overriding the original templates.</div><div><br></div><div>Cheers,</div><div>Alessio.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 8, 2021 at 2:20 PM Toni Schönbuchner <<a href="mailto:toni.schoenbuchner@csgis.de">toni.schoenbuchner@csgis.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Hi devs,<div><br></div><div>I’m just testing the workshop docs for gn 4 (master branch). </div><div><a href="https://docs.geonode.org/en/master/devel/workshops/index.html" target="_blank">https://docs.geonode.org/en/master/devel/workshops/index.html</a></div><div><br></div><div>One question regarding (the really usefuel) extending of metadata.</div><div>In master it looks several fields have moved from resourceBase to Dataset Model.</div><div>So let’s say we patch directly the Dataset Model in apps:</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;line-height:18px;white-space:pre-wrap"><div> ….</div><div><span style="color:rgb(86,156,214)"> def</span> <span style="color:rgb(220,220,170)">patch_layers_dataset</span>(<span style="color:rgb(156,220,254)">self</span>, <span style="color:rgb(156,220,254)">cls</span>):</div><div> <span style="color:rgb(156,220,254)">self</span>.<span style="color:rgb(220,220,170)">_get_logger</span>().<span style="color:rgb(220,220,170)">info</span>(<span style="color:rgb(206,145,120)">"Patching Dataset"</span>)</div><div> <span style="color:rgb(156,220,254)">animals_help_text</span> = <span style="color:rgb(220,220,170)">_</span>(<span style="color:rgb(206,145,120)">'Your animals'</span>)</div><div> <span style="color:rgb(156,220,254)">animals</span> = <span style="color:rgb(156,220,254)">models</span>.<span style="color:rgb(220,220,170)">TextField</span>(</div><div> <span style="color:rgb(220,220,170)">_</span>(<span style="color:rgb(206,145,120)">'animals'</span>),</div><div> <span style="color:rgb(156,220,254)">blank</span>=<span style="color:rgb(156,220,254)">True</span>,</div><div> <span style="color:rgb(156,220,254)">null</span>=<span style="color:rgb(156,220,254)">True</span>,</div><div> <span style="color:rgb(156,220,254)">help_text</span>=<span style="color:rgb(156,220,254)">animals_help_text</span>)</div><div> <span style="color:rgb(156,220,254)">cls</span>.<span style="color:rgb(220,220,170)">add_to_class</span>(<span style="color:rgb(206,145,120)">'animals'</span>, <span style="color:rgb(156,220,254)">animals</span>)</div><br><div><span style="white-space:pre-wrap"> </span>...</div><br><div> <span style="color:rgb(86,156,214)">def</span> <span style="color:rgb(220,220,170)">ready</span>(<span style="color:rgb(156,220,254)">self</span>):</div><div> <span style="color:rgb(220,220,170)">super</span>(<span style="color:rgb(156,220,254)">AppConfig</span>, <span style="color:rgb(156,220,254)">self</span>).<span style="color:rgb(220,220,170)">ready</span>()</div><div> <span style="color:rgb(220,220,170)">run_setup_hooks</span>()</div><span style="white-space:pre-wrap"> </span>...<br><div> <span style="color:rgb(86,156,214)">from</span> <span style="color:rgb(156,220,254)">geonode</span>.<span style="color:rgb(156,220,254)">layers</span>.<span style="color:rgb(156,220,254)">models</span> <span style="color:rgb(86,156,214)">import</span> <span style="color:rgb(156,220,254)">Dataset</span></div><div> <span style="color:rgb(156,220,254)">self</span>.<span style="color:rgb(220,220,170)">patch_layers_dataset</span>(<span style="color:rgb(156,220,254)">Dataset</span>)</div></div></div><div><br></div><div><br></div><div>The new animals field now shows up in Django Admin and saves the data correctly.</div><div>I would now expect to extend the metadata Wizard in <span style="font-family:Menlo;font-size:11px">/layers/templates/layouts/panels.html</span></div><div>like:</div><div><br></div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;line-height:18px;white-space:pre-wrap"><div> <span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">span</span><span style="color:rgb(128,128,128)">></span><span style="color:rgb(128,128,128)"><</span><span style="color:rgb(86,156,214)">label</span> <span style="color:rgb(156,220,254)">for</span>=<span style="color:rgb(206,145,120)">"{{ dataset_form.animal|id }}"</span><span style="color:rgb(128,128,128)">></span>{{ dataset_form.animals.label }}<span style="color:rgb(128,128,128)"></</span><span style="color:rgb(86,156,214)">label</span><span style="color:rgb(128,128,128)">></</span><span style="color:rgb(86,156,214)">span</span><span style="color:rgb(128,128,128)">></span></div><div> {{ dataset_form.animals }}</div></div></div><div><br></div><div>But the animals field is not populated (which in my opinion it should: <a href="https://github.com/GeoNode/geonode/blob/8b45f7d70a907764a99af9e99abfe7a9ea232a33/geonode/layers/forms.py#L45-L59" target="_blank">https://github.com/GeoNode/geonode/blob/8b45f7d70a907764a99af9e99abfe7a9ea232a33/geonode/layers/forms.py#L45-L59</a>)</div><div><br></div><div><br></div><div>What do I miss that the dataset form respects the new field?</div><div><br></div><div><br></div><div>Thanks,</div><div><br></div><div>Toni</div><div><div>
</div>
<br></div></div>_______________________________________________<br>
geonode-devel mailing list<br>
<a href="mailto:geonode-devel@lists.osgeo.org" target="_blank">geonode-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/geonode-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geonode-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">Regards,</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">Alessio Fabiani</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">==</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">GeoServer Professional Services from the experts!</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">Visit </span><a href="http://bit.ly/gs-services-us" target="_blank"><span style="font-size:11pt;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap">http://bit.ly/gs-services-us</span></a><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"> for more information.</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">==</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">Ing. Alessio Fabiani</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">@alfa7691</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">Founder/Technical Lead</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">GeoSolutions Group</span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">phone: +39 0584 962313</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">fax: +39 0584 1660272</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">mob: +39 333 8128928</span></p><br><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><a href="https://www.geosolutionsgroup.com/" target="_blank"><span style="font-size:11pt;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap">https://www.geosolutionsgroup.com/</span></a></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><a href="http://twitter.com/geosolutions_it" target="_blank"><span style="font-size:11pt;font-family:Arial;color:rgb(17,85,204);vertical-align:baseline;white-space:pre-wrap">http://twitter.com/geosolutions_it</span></a></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(34,34,34);vertical-align:baseline;white-space:pre-wrap">-------------------------------------------------------</span></p><br><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">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.</span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><br></span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">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.</span></span><br></div></div>