[Answer]-Django 'Post' object has no attribute '__getitem__'

1👍

The main problem here is that p is a model instance, which does not support dict-style attribute access syntax. To access the post attribute, use the standard dot syntax, p.post.

The second problem is that you can’t use append to change a Unicode or string object – they’re immutable. Instead, you should create a new Unicode object containing the content you want and assign that. For instance:

p.post = post.cleaned_data['body'] + unicode(quote)

Leave a comment