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 8112811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:38:03+00:00 2026-06-06T02:38:03+00:00

Is there any way to override admin templates with different files depending on Django

  • 0

Is there any way to override admin templates with different files depending on Django version?

I’ve copied admin/index.hml from Django admin templates, to achieve this: Django admin, hide a model, but there are changes in that template in different versions of Django, and sometimes the page breaks (specially with the deprecation of ADMIN_MEDIA_PREFIX in Django 1.4)

I want to install my site in many servers with different versions of Django, but using just one unified code that notices the version automatically. Is that possible?

I’ve checked Django documentation, but I haven’t found anything about this.

  • 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-06T02:38:05+00:00Added an answer on June 6, 2026 at 2:38 am

    The ModelAdmin class has various template settings that you can specify in subclasses. In Django 1.3 these are (at django.contrib.admin.options, line 271):

    add_form_template = None
    change_form_template = None
    change_list_template = None
    delete_confirmation_template = None
    delete_selected_confirmation_template = None
    object_history_template = None
    

    Similarly, AdminSite has various template settings (at django.contrib.admin.sites, line 35):

    index_template = None
    app_index_template = None
    login_template = None
    logout_template = None
    password_change_template = None
    password_change_done_template = None
    

    You can override these for subclasses or specify them in a central location in your code (e.g., a __init__.py file). For example:

    from django.contrib.admin.sites import AdminSite
    AdminSite.index_template = '...'
    

    You can then vary the templates based on the current Django version. You may need to check what the code looks like in earlier Django versions as I haven’t checked if all these variables are present in earlier Django admin code.

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

Sidebar

Related Questions

Is there any way to override z-index inheritance from parent elements when using absolute
Is there any way to override a class method with a lambda function? For
Is there any way to override the comparison function in a F# set? I
Is there any way I can run class files (i.e. with main as the
Is there any way to override a error_message text for all the fields of
Is there any way to override a non-virtual method? or something that gives similar
Is there any way to override, or re-add something that was removed via it's
If a javascript function is declared anonymously is there any way to override it
Is there any way to override the line numbers in Java (e.g., by using
I'm wondering, is there any way to override ToString() method of the class field

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.