[GeoNode-users] Upload documents in bulk

Nic Tait ngtait at gmail.com
Mon Oct 12 06:56:02 PDT 2015


Thanks Paolo, I have been experimenting with the Document model as a way to
do this with some success so far

- Nic

On Mon, Oct 12, 2015 at 7:40 AM, Paolo Corti <pcorti at gmail.com> wrote:

> Do something like this (not tested):
>
> from geonode.documents.models import Document
>
> doc_list = [
>     {'title': 'title0', 'doc_file': '/path/to/file/0'},
>     {'title': 'title1', 'doc_file': '/path/to/file/1'},
>     {'title': 'title2', 'doc_file': '/path/to/file/2'},
> ]
>
> owner = Profile.objects.all()[0] # change according to your needs
>
> for doc in doc_list:
>     doc = Document(
>         title = doc['title'],
>         doc_file = doc['doc_file'],
>         owner = owner
>     )
>     doc.save()
>
> hope it helps
> p
>
> On Tue, Oct 6, 2015 at 3:12 PM, Nic Tait <ngtait at gmail.com> wrote:
> > Hi all,
> >
> > Would like to be able to use Geonode as a map catalog for a large number
> of
> > pdf / png files but not sure of the best way to do this in bulk?  Cannot
> see
> > anything in the documentation to do this so wondering if I need to
> create a
> > python script using the django models - has anyone done anything similar
> ?
> >
> > Thanks,
> > Nic
> >
> > _______________________________________________
> > geonode-users mailing list
> > geonode-users at lists.osgeo.org
> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/geonode-users
> >
>
>
>
> --
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net
> twitter: @capooti
> skype: capooti
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-users/attachments/20151012/5828b2ad/attachment.html>


More information about the geonode-users mailing list