Currently, I have a script that is used to import data into Plone, however, each News Item is added to navigation bar. I want to avoid this. At first, I tried exclude_from_nav=True
and excludeFromNav=True
, but it's not working.
My import code looks like this:
def create_news_item(level, id, base_path, path_, name, data):
otherdata = {
"excludeFromNav":True,
"contributors":data["contributors"],
"text":RichTextValue(data["text"]),
"expirationDate":data["expirationDate"],
"allowDiscussion":data["allowDiscussion"],
"atrefs":data.get("_atrefs", {}),
"imageCaption":data["imageCaption"]
}
if "image" in data:
otherdata["image"] = data["image"]
otherdata["imageCaption"] = data["imageCaption"]
_path = "/".join(base_path.split('/')[:-1])
if level > 1:
container = api.content.get(path=_path)
else:
container = api.portal.get()
if container and id not in container:
obj = newsitem = api.content.create(
type='News Item',
title=name,
id=id,
safe_id=False,
container=container,
**otherdata)
setuid(obj, data['_uid'])
if '_datafield_image' in data:
image_data = data['_datafield_image']
newsitem.image = prep_image(
imagename=image_data['filename'],
data=image_data['data'],
content_type=data['_content_type'],
)
else:
print "content already present for {}".format(base_path)
print "type is :{}, path is:{},{}".format(data['_type'],
data['_path'], level + 2)
Any ideas?