<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi devs,<div class=""><br class=""></div><div class="">I’m just testing the workshop docs for gn 4 (master branch). </div><div class=""><a href="https://docs.geonode.org/en/master/devel/workshops/index.html" class="">https://docs.geonode.org/en/master/devel/workshops/index.html</a></div><div class=""><br class=""></div><div class="">One question regarding (the really usefuel) extending of metadata.</div><div class="">In master it looks several fields have moved from resourceBase to Dataset Model.</div><div class="">So let’s say we patch directly the Dataset Model in apps:</div><div class=""><br class=""></div><div class=""><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;" class=""><div class="">    ….</div><div class=""><span style="color: #569cd6;" class="">    def</span> <span style="color: #dcdcaa;" class="">patch_layers_dataset</span>(<span style="color: #9cdcfe;" class="">self</span>, <span style="color: #9cdcfe;" class="">cls</span>):</div><div class="">        <span style="color: #9cdcfe;" class="">self</span>.<span style="color: #dcdcaa;" class="">_get_logger</span>().<span style="color: #dcdcaa;" class="">info</span>(<span style="color: #ce9178;" class="">"Patching Dataset"</span>)</div><div class="">        <span style="color: #9cdcfe;" class="">animals_help_text</span> = <span style="color: #dcdcaa;" class="">_</span>(<span style="color: #ce9178;" class="">'Your animals'</span>)</div><div class="">        <span style="color: #9cdcfe;" class="">animals</span> = <span style="color: #9cdcfe;" class="">models</span>.<span style="color: #dcdcaa;" class="">TextField</span>(</div><div class="">            <span style="color: #dcdcaa;" class="">_</span>(<span style="color: #ce9178;" class="">'animals'</span>),</div><div class="">            <span style="color: #9cdcfe;" class="">blank</span>=<span style="color: #9cdcfe;" class="">True</span>,</div><div class="">            <span style="color: #9cdcfe;" class="">null</span>=<span style="color: #9cdcfe;" class="">True</span>,</div><div class="">            <span style="color: #9cdcfe;" class="">help_text</span>=<span style="color: #9cdcfe;" class="">animals_help_text</span>)</div><div class="">        <span style="color: #9cdcfe;" class="">cls</span>.<span style="color: #dcdcaa;" class="">add_to_class</span>(<span style="color: #ce9178;" class="">'animals'</span>, <span style="color: #9cdcfe;" class="">animals</span>)</div><br class=""><div class=""><span class="Apple-tab-span" style="white-space:pre">    </span>...</div><br class=""><div class="">    <span style="color: #569cd6;" class="">def</span> <span style="color: #dcdcaa;" class="">ready</span>(<span style="color: #9cdcfe;" class="">self</span>):</div><div class="">        <span style="color: #dcdcaa;" class="">super</span>(<span style="color: #9cdcfe;" class="">AppConfig</span>, <span style="color: #9cdcfe;" class="">self</span>).<span style="color: #dcdcaa;" class="">ready</span>()</div><div class="">        <span style="color: #dcdcaa;" class="">run_setup_hooks</span>()</div><span class="Apple-tab-span" style="white-space:pre">       </span>...<br class=""><div class="">        <span style="color: rgb(86, 156, 214);" class="">from</span> <span style="color: rgb(156, 220, 254);" class="">geonode</span>.<span style="color: rgb(156, 220, 254);" class="">layers</span>.<span style="color: rgb(156, 220, 254);" class="">models</span> <span style="color: rgb(86, 156, 214);" class="">import</span> <span style="color: rgb(156, 220, 254);" class="">Dataset</span></div><div class="">        <span style="color: rgb(156, 220, 254);" class="">self</span>.<span style="color: rgb(220, 220, 170);" class="">patch_layers_dataset</span>(<span style="color: rgb(156, 220, 254);" class="">Dataset</span>)</div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The new animals field now shows up in Django Admin and saves the data correctly.</div><div class="">I would now expect to extend the metadata Wizard in <span style="font-family: Menlo; font-size: 11px;" class="">/layers/templates/layouts/panels.html</span></div><div class="">like:</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><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;" class=""><div class="">          <span style="color: #808080;" class=""><</span><span style="color: #569cd6;" class="">span</span><span style="color: #808080;" class="">></span><span style="color: #808080;" class=""><</span><span style="color: #569cd6;" class="">label</span> <span style="color: #9cdcfe;" class="">for</span>=<span style="color: #ce9178;" class="">"{{ dataset_form.animal|id }}"</span><span style="color: #808080;" class="">></span>{{ dataset_form.animals.label }}<span style="color: #808080;" class=""></</span><span style="color: #569cd6;" class="">label</span><span style="color: #808080;" class="">></</span><span style="color: #569cd6;" class="">span</span><span style="color: #808080;" class="">></span></div><div class="">          {{ dataset_form.animals }}</div></div></div><div class=""><br class=""></div><div class="">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" class="">https://github.com/GeoNode/geonode/blob/8b45f7d70a907764a99af9e99abfe7a9ea232a33/geonode/layers/forms.py#L45-L59</a>)</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">What do I miss that the dataset form respects the new field?</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Toni</div><div class=""><div class="">
</div>

<br class=""></div></body></html>