[GeoNode-users] Query recent maps in views.py

Paolo Corti pcorti at gmail.com
Wed Sep 20 06:44:46 PDT 2017


I think Donny would like to see thumbnails of recently update maps.

If this is the case, this can be easily done with:
Map.objects.all().order_by('-last_modified') in the views.py.
Then use map.get_thumbnail_url in the template

p

On Wed, Sep 20, 2017 at 9:38 AM, Simone Dalmasso
<simone.dalmasso at gmail.com> wrote:
> Hi,
>
> what you need is not trivial. GeoNode doesn't have a model for Thumbnails,
> they are managed through Links
> (https://github.com/GeoNode/geonode/blob/2.6.x/geonode/base/models.py#L892),
> but a Link doesn't have a timestamp for its creation, so you would need
> something to read the files from the disk.
>
> Maybe the way to go could be to create your own model for recent thumbnails
> and update their status in the db through a cron celery task. So your view
> would easily read from it.
>
> Hope it helps and others ideas are welcome.
>
> 2017-09-20 10:35 GMT+02:00 Arisandi, Donny (ICRAF) <D.Arisandi at cgiar.org>:
>>
>> Dear all,
>>
>>
>>
>> I need your help to create query in views.py to show recent map thumbnail.
>> Could you show me the sample how to do it?
>>
>>
>>
>> Thank you
>>
>> D
>>
>>
>> _______________________________________________
>> geonode-users mailing list
>> geonode-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/geonode-users
>>
>
>
>
> --
> Simone
>
> _______________________________________________
> geonode-users mailing list
> geonode-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geonode-users
>



-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the geonode-users mailing list