[GeoNode-users] Overwrite Core Model in geonode project

Simone Dalmasso simone.dalmasso at gmail.com
Thu Feb 2 03:04:39 PST 2017


correct but is a big and heavy work. as said, creating you own fork of
GeoNode may be a better solution!

2017-02-02 12:02 GMT+01:00 Toni Schönbuchner <toni.schoenbuchner at csgis.de>:

> 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:
>
>
>    1. copy apps: */base* and */layers* to */var/www/my_project*
>    2. Routing views: change * my_project/layers/urls.py* to use
>    *my_project/layers/views.py*
>       1.  https://github.com/GeoNode/geonode/blob/2.4.x/geonode/
>       layers/urls.py#L30
>    3. models: change *my_project/layers/views.py* to use
>    *my_project/layers/models.py*
>       1. https://github.com/GeoNode/geonode/blob/2.4.x/geonode/
>       layers/views.py#L47
>    4. change *my_project/models.py* to use *my_project/base/models.py*
>       1. https://github.com/GeoNode/geonode/blob/2.4.x/geonode/
>       layers/models.py#L33
>
>
> Correct?
>
> Thanks a lot,
>
> Toni
>
> 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>
> :
>
>> 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
>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>
>
>
>
> --
> Simone
>
>
>


-- 
Simone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20170202/30c28cd4/attachment.html>


More information about the geonode-users mailing list