def create_topic_from_title(title):
	topic = Topic({
		"slug": Topic.normalize_slug(title),
		"titles": [{
			"text": title,
			"lang": "he" if is_hebrew(title) else "en",
		"primary": True,
		}]
	})
	topic.save()
	return topic
Esempio n. 2
0
def make_topic(slug):
    ts = TopicSet({'slug': slug})
    if ts.count() > 0:
        ts.delete()
    t = Topic({
        'slug': slug,
        'titles': [{
            'text': slug,
            'primary': True,
            'lang': 'en'
        }]
    })
    t.save()
    return t