Reputation: 958
For example:
tags_input = "hello, foo, bar, ok"
tagset = tag_parser(tags_input) # {'bar', 'foo', 'hello', 'ok'}
obj = Post(title=title, tags=tagset)
obj.save()
The above snippet doesn't seem to work. How can I create tags programmatically? e.g. in views
Upvotes: 3
Views: 590
Reputation: 958
According to Taggit documentation:
apple = Food.objects.create(name="apple")
apple.tags.add("red", "green", "delicious")
Upvotes: 1