[GeoNode-users] How to customize geonode core apps(adding your own logic to models.py for example)

Dave Kennewell davekennewell at gmail.com
Mon Jun 17 09:24:26 PDT 2019

Hi Edgar,

Yes, Francesco's advice to create your own app is what I would do. Once you
have that app, to add logic to the geonode.maps model, there are two
options (probably lots more) that I would consider.

If you want to add custom fields to the Maps model, you can extend the
model in your app with something like (pseudocode, not tested!):

from geonode.maps import Map
class MapExtention(models.model):
    map = models.OneToOneField(Map, on_delete=models.CASCADE)
    my_new_map_field = CharField(max_length=100)

Then access these fields through map.mapextention.my_new_map_field

Or if you want to execute functions upon Map model changes you can use
django's signals framework to listen for changes in the core Map model
file. https://docs.djangoproject.com/en/1.11/topics/signals/

Both these solutions should avoid the need to modify core geonode, but give
your maps some additional functions.

Hope that helps & good luck :)


On Mon, 17 Jun 2019 at 19:50, xbartolone [via OSGeo.org] <
ml+s1560n5408236h31 at n6.nabble.com> wrote:

> Hi Edgar,
> you are in the right track with the geonode-project. For more advance
> hacking you can have a look at the dev workshop here
> http://geonode.org/dev-workshop/#/, maybe jump directly in these sections:
> http://geonode.org/dev-workshop/#/5
> http://geonode.org/dev-workshop/#/6
> Hope this helps
> Francesco
> Il 17 giu 2019, 15:23 +0200, edgar mlowe <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=5408236&i=0>>, ha scritto:
> Hello,
> I want to add my own logic to modals.py in maps app(one of geonode core
> app). can someone advise me how to achieve that without changing Geonode
> code base.
> Iam running geonode using docker in development mode, I have installed my
> geonode using the guide from the geonode-project(
> https://github.com/GeoNode/geonode-project).
> Thanks in advance for anyone who can help me,
> Best,
> Edgar.
> _______________________________________________
> geonode-users mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5408236&i=1>
> https://lists.osgeo.org/mailman/listinfo/geonode-users
> _______________________________________________
> geonode-users mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=5408236&i=2>
> https://lists.osgeo.org/mailman/listinfo/geonode-users
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://osgeo-org.1560.x6.nabble.com/How-to-customize-geonode-core-apps-adding-your-own-logic-to-models-py-for-example-tp5408221p5408236.html
> To unsubscribe from GeoNode, click here
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5185390&code=ZGF2ZWtlbm5ld2VsbEBnbWFpbC5jb218NTE4NTM5MHwtOTI1NjEyMTk0>
> .
> <http://osgeo-org.1560.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20190617/592b8f80/attachment.html>

More information about the geonode-users mailing list