Re: [Wagtail] Creating a new collection programmatically

337 views
Skip to first unread message

Matthew Westcott

unread,
Aug 13, 2016, 10:06:27 PM8/13/16
to wag...@googlegroups.com
Hi Rani,

It works for me:

>>> from wagtail.wagtailcore.models import Collection
>>> root_collection = Collection.get_first_root_node()
>>> root_collection.add_child(name='test')
<Collection: test>

Can you give the full stack trace?

Cheers,
- Matt

On 13 Aug 2016, at 19:52, rani....@snip.today wrote:

> Hi,
>
> I have a simple script to upload multiple images and I works fine.
> I'm trying to create a new collection for my images (I get the collection name as an argument).
> It's supposed to be pretty simple but it doesn't work.
>
> root_collection = Collection.get_first_root_node()
> base_collection.add_child(name='test')
>
> I'm getting this error - AttributeError: 'NoneType' object has no attribute '_inc_path' -
> I have no idea why.
>
> Thanks!
>
> Rani

rani....@snip.today

unread,
Aug 14, 2016, 6:35:39 AM8/14/16
to Wagtail support
Hi,

I know :)
My DB was corrupted...
I deleted the post but I guess it didn't work.

Thanks anyway!


On Sunday, 14 August 2016 05:06:27 UTC+3, Matthew Westcott wrote:
Hi Rani,

It works for me:

>>> from wagtail.wagtailcore.models import Collection
>>> root_collection = Collection.get_first_root_node()
>>> root_collection.add_child(name='test')
<Collection: test>

Can you give the full stack trace?

Cheers,
- Matt

YusufSalahAdDin

unread,
May 5, 2017, 8:11:16 PM5/5/17
to Wagtail support
It works for me, at least in shell, becuase in migrations doesn't works
Reply all
Reply to author
Forward
0 new messages