alex/django-taggit — Issue #95: Ability to add tags during model creation
Author: willy1234x1
Created: 2012-02-04 19:23:47+00:00
State: open

I'm trying to write a feature into an app of mine, here's how I basically would like to do it, but I can't seem to find any documented way of doing it with Django-taggit as is.

The basic idea is that my app is fed a string
"Foobar #spam #eggs #ham"
and I was trying to take those parts split at the hash mark and add them as tags (this is all happening within models.py)
But there doesn't seem to be a way to pass in your tags to the TaggableManager.

Here's some code I tried:

```def get_tags(self):
parts = self.body.split('#')
if len(parts) >= 2:
self.body = parts[0]
if len(parts) == 2:
self.tags = TaggableManager(parts[1])
elif len(parts) > 2:
for i in parts[1:]:
self.tags = TaggableManager(parts[i])
```

Something I would like is if you could pass in an argument to the TaggableManager like so:

```
tags = TaggableManager(tags='foo')
tags = TaggableManager(tags=['foo', 'bar'])
tags = TaggableManager(tags=('foo', 'bar'))
```
Again, I'm not sure if this is possible. But here's the models.py from the app I was working on to illustrate what I was trying to do. http://dpaste.com/697530/