ahow can I resolve Django Error: str' object has no attribute 'autoescape'?
- by Angelbit
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>