stephenmcd/mezzanine — Issue #103: Error when deleting BlogPost with keywords
Author: wesleyb
Created: 2011-11-13 19:59:43+00:00
State: open

First of all thank you for mezzanine, it's a great blog engine for us.

I found a problem when I try to delete a blogpost which contains keywords.
You can reproduce the error with this code.

Thank you !

Wesley

```python
from django.contrib.auth.models import User
from mezzanine.core.models import CONTENT_STATUS_PUBLISHED
from mezzanine.generic.models import AssignedKeyword, Keyword
from mezzanine.blog.models import BlogPost

bp = BlogPost()
bp.user_id = User.objects.all()[0].id
bp.title = 'test1'
bp.status = CONTENT_STATUS_PUBLISHED
bp.content = 'test1 content'
bp.save()

tag = 'test1'
keyword, created = Keyword.objects.get_or_create(title=tag)
bp.keywords.add(AssignedKeyword(keyword=keyword))

bp.delete()
```