I have the Django project with the Model to save date_added information. Here's the Model code.
class Outputting(models.Model):
date_added = models.DateTimeField(auto_now_add=True)
And I want to retrieve such date_added information and demonstrate it as the local time in the html. How could I make the transformation? Here's the view.py and html template, but it still show the UTC time.
view.py
def results(request):
user = request.user
data = Outputting.objects.filter(owner=user).order_by('id').values_list('id','date_added')
return render(request, "xx.html", {"data": data})
Html:
<tr>
{% for i in data %}
<td style="word-wrap:break-word;"><div class="panel-body" type="datetime-local"><small>{{ i.1|date:'M d Y H:i:s' }}</small></div></td>
</tr class="something">
{% endfor %}