I have the following code for model and admin. The question column contains HTML content such as a URL and image tags. However, the administrator still displays the original HTML content and non-formatted content. The model and admin code are below:
Model
class question(models.Model): question_id = models.AutoField(primary_key=True)
Administrator
class QuestionAdmin(admin.ModelAdmin): list_display = ('question_id','formatqn') list_per_page = 10 def formatqn(self, obj): return u'%s' % obj.question formatqn.allow_tags = True admin.site.register(question, QuestionAdmin)
source share