R
R
roman_roman2016-07-19 19:10:41
Django
roman_roman, 2016-07-19 19:10:41

Why don't tempate tags work in Django admin panel?

Django 1.9, using the Post model to create a post in the django admin panel.
I add text to the Content field:
Text {{ value|linebreaks }} Text
Save, go to the post page. The line remains the same :
Text {{ value|linebreaks }} Text
That is, the template tag does not work. Did according to this tutorial.
admin.py and models.py code for the blog app:

from django.contrib import admin
from blog.models import Post 

# Register your models here.

admin.site.register(Post)

models.py:
from django.db import models
# Create your models here.

class Post(models.Model):
  title = models.CharField(max_length=255)
  datetime = models.DateTimeField(u'Дата публикации')
  content = models.TextField(max_length=10000)

  def __unicode__(self):
    return self.title

  def get_absolute_url(self):
    return '/blog/%i/' % self.id

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
un1t, 2016-07-19
@un1t

Duck it should be in the template, and you stuffed it into the model.
some.html
{{ post.content|linebreaks}}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question