ahow can I resolve Django Error: str' object has no attribute 'autoescape'?

Posted by Angelbit on Stack Overflow See other posts from Stack Overflow or by Angelbit
Published on 2010-05-12T16:27:17Z Indexed on 2010/05/12 16:44 UTC
Read the original article Hit count: 262

Filed under:
|

Hi

have tried to create a inclusion tag on Django but don't work and return

str' object has no attribute 'autoescape'

this is the code of custom tag:

from django import template
from quotes.models import Quotes 

register = template.Library()
def show_quote():
    quote = Quotes.objects.values('quote', 'author').get(id=0)
    return {'quote': quote['quote']}
register.inclusion_tag('quotes.html')(show_quote)

EDIT: Quote class

from django.db import models

class Quotes(models.Model):
quote = models.CharField(max_length=255)
author = models.CharField(max_length=100)
class Meta:
    db_table = 'quotes'

quotes.html

<blockquote id="quotes">{{ quote }}</blockquote>

© Stack Overflow or respective owner

Related posts about django

Related posts about python