[GeoNode-users] Overwrite Core Model in geonode project

Toni Schönbuchner toni.schoenbuchner at csgis.de
Thu Feb 2 03:02:26 PST 2017

Dear Simone,

thanks for your fast reply! Would you kindly check if I understood your advise correctly and picked the right places?

> You have to define your own url, views etc.

The metadata page is managed in first instance of layers app.
layers/urls.py points to layers/views.py
layers/views.py uses layers/models.py
layers/model.py inherits from base/models.py

This means it could work like this:

copy apps: /base and /layers to /var/www/my_project
Routing views: change  my_project/layers/urls.py to use  my_project/layers/views.py
 https://github.com/GeoNode/geonode/blob/2.4.x/geonode/layers/urls.py#L30 <https://github.com/GeoNode/geonode/blob/2.4.x/geonode/layers/urls.py#L30>
models: change my_project/layers/views.py to use my_project/layers/models.py
https://github.com/GeoNode/geonode/blob/2.4.x/geonode/layers/views.py#L47 <https://github.com/GeoNode/geonode/blob/2.4.x/geonode/layers/views.py#L47>
change my_project/models.py to use my_project/base/models.py
https://github.com/GeoNode/geonode/blob/2.4.x/geonode/layers/models.py#L33 <https://github.com/GeoNode/geonode/blob/2.4.x/geonode/layers/models.py#L33>


Thanks a lot,


> Am 02.02.2017 um 10:53 schrieb Simone Dalmasso <simone.dalmasso at gmail.com>:
> Hi, the way to use your own models instead of the default ones is quite tricky.
> You have to define your own url, views etc. This is one of the cases where a fork could be an option to consider.
> 2017-02-02 10:26 GMT+01:00 Toni Schönbuchner <toni.schoenbuchner at csgis.de <mailto:toni.schoenbuchner at csgis.de>>:
> Dear List,
> on Geonode 2.4 (Ubuntu 14.04) I´d like to extend the metadata details page (route /metadata).
> This works perfectly by extending the base model which lives under:
> /usr/local/lib/python2.7/dist-packages/geonode/base/models.py
> To not hack the core we created a new project under /var/www/my_project
> and copied the base app there (/var/www/my_project/base).
> Template overrides work as expected but unfortunately it seems project models are ignored
> (and still the core model is utilized).
> What is the recommended way to customize models without changing the core?
> Thanks,
> Toni
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org <mailto:geonode-users at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/geonode-users <https://lists.osgeo.org/mailman/listinfo/geonode-users>
> --
> Simone

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20170202/6a6d5674/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20170202/6a6d5674/attachment-0001.sig>

More information about the geonode-users mailing list