5👍
The html of the description field can be accessed like this (try in django shell):
Race.objects.all()[0].html
You can for example render all races in an html with the code below.
Note you need to use the ‘safe’ argument in jinja to have the variable interpreted as html code instead of text.
In the views.py:
def show_races(request):
races_all = Race.objects.all()
return render(request, "races.html", {"races_all": races_all})
In your races.html:
{% for race in races_all %}
<h1> {{ race.name }} </h1>
{{ race.description.html|safe }}
{% endfor %}
👤Simi
- [Django]-Match String to Array of Strings in Postgres Database Column
- [Django]-Django + jQuery: Why CSRF verification fails on multiple simultaneous requests
Source:stackexchange.com