Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8515757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:14:08+00:00 2026-06-11T05:14:08+00:00

I want to render all datetime objects in all templates in a django application

  • 0

I want to render all datetime objects in all templates in a django application in a certain manner, using common code for all datetime objects that might be passed all the way to the template.

Without going too much in to details, please note that the following are not viable otions.:

  • use a filter or a custom template tag in the template
  • subclassing datetime
  • setting DATETIME_FORMAT to a magic value
  • using a custom timezone and some TimeZoneMiddlWare
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T05:14:10+00:00Added an answer on June 11, 2026 at 5:14 am

    Create your own datetime class and monkeypatch the datetime module early in the app setup.
    (Maybe you need to monkeypatch all imported modules too, depends on how early you can do this

     import datetime
    
     class mydatetime(object):
         ...
         def render(self):
             ...
    
     datetime.datetime = mydatetime
    

    It’s easier if you subclass the datetime object for sure, but you don’t have to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to render the partial view using ajax. When I submit the button,
I want to render a profile user container that contains a list of labels
I want to create a django app that can upload and display images. However
I am having a slight problem. I want a django app that can upload
I have some code that is used to replace certain page output with other
I want to render some json data using HTML template. I haven't started implementing
In my rails app, I want to render certain pages within a lightbox but
Hello I'm a Django Beginner. I have a calendar that I want to be
I want to keep all of my JavaScript code in one section; just before
I want to render a table which holds all entity data. There should be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.