title: How to show datetime in Django in specific timezone?
body: <p>I have a Django (v1.10.6) project that has some models with datetime fields, for example:</p>
  
  <pre><code>created_at = models.DateTimeField(auto_now_add=True)
  </code></pre>
  
  <p>that are stored in PostgreSQL database without timezone information:</p>
  
  <pre><code>created_at timestamp without time zone NOT NULL
  </code></pre>
  
  <p><code>postgresql.conf</code>:</p>
  
  <pre><code>timezone = 'UTC'
  </code></pre>
  
  <p>I want all the dates of my application to be shown in <code>America/Bogota</code> time zone (it shouldn't depend on user's actual time zone), so my <code>settings.py</code> file has the following configuration:</p>
  
  <pre><code>TIME_ZONE = 'America/Bogota'
  USE_I18N = False
  USE_L10N = True
  USE_TZ = True
  
  SHORT_DATETIME_FORMAT = 'd-m-Y H:i:s'
  SHORT_DATE_FORMAT = 'd-m-Y'
  TIME_FORMAT = 'H:i:s'
  </code></pre>
  
  <p>but when I write </p>
  
  <pre><code>{{ object.created_at|date:'SHORT_DATETIME_FORMAT' }}
  </code></pre>
  
  <p>in templates, it still shows the date in <code>UTC</code> format.</p>
  
  <p>Update:</p>
  
  <p>I added the following middleware, but it didn't help:</p>
  
  <pre><code>class TimezoneMiddleware(MiddlewareMixin):
      def process_request(self, request):
          timezone.activate(pytz.timezone(settings.TIME_ZONE))
  </code></pre>
  
  <p>Update 2:</p>
  
  <p>It works the following way:</p>
  
  <pre><code>import pytz
  from django.utils import timezone
  
  timezone.is_naive(object.created_at)  # True
  object.created_at.replace(tzinfo=timezone.utc)
  </code></pre>
  
  <p>(forcing the date to be in <code>UTC</code> timezone and then passing it to template without <code>localize</code> filter) but I don't understand why Django still returns naive datetime when <code>USE_TZ</code> is set to <code>True</code>.</p>