SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. your_project
  2.      |-- your_project/
  3.      |-- myapp/
  4.      |-- templates/
  5.           |-- admin/
  6.               |-- myapp/
  7.                   |-- change_form.html  <- do not misspell this
  8.      
  9. TEMPLATES = [
  10.     {
  11.         'BACKEND': 'django.template.backends.django.DjangoTemplates',
  12.         'DIRS': [os.path.join(BASE_DIR, 'templates')], # <- add this line
  13.         'APP_DIRS': True,
  14.         'OPTIONS': {
  15.             'context_processors': [
  16.                 'django.template.context_processors.debug',
  17.                 'django.template.context_processors.request',
  18.                 'django.contrib.auth.context_processors.auth',
  19.                 'django.contrib.messages.context_processors.messages',
  20.             ],
  21.         },
  22.     },
  23. ]
  24.      
  25. ~/.virtualenvs/edge/lib/python2.7/site-packages/django/contrib/admin/templates/admin
  26.      
  27. {% extends "admin/change_form.html" %}
  28. {% block field_sets %}
  29.      {# your modification here #}
  30. {% endblock %}
  31.      
  32. # urls.py
  33. ...
  34. from django.contrib import admin
  35.  
  36. admin.site.index_template = 'admin/my_custom_index.html'
  37. admin.autodiscover()
  38.      
  39. class Myadmin(admin.ModelAdmin):
  40.     change_form_template = 'change_form.htm'
  41.      
  42. app_index.html
  43. change_form.html
  44. change_list.html
  45. delete_confirmation.html
  46. object_history.html
  47.      
  48. your_project
  49.  |-- your_project/
  50.  |-- myapp/
  51.  |-- templates/
  52.       |-- admin/
  53.           |-- login.html  <- do not misspell this
  54.      
  55. {% extends 'django_admin/change_form.html' %}
  56.  
  57. Your stuff here
  58.      
  59. mysite-container/         # project container directory
  60.     manage.py
  61.     mysite/               # project package
  62.         __init__.py
  63.         admin.py
  64.         apps.py
  65.         settings.py
  66.         urls.py
  67.         wsgi.py
  68.     app1/
  69.     app2/
  70.     ...
  71.     static/
  72.     templates/
  73.      
  74. ln -s /usr/local/lib/python2.7/dist-packages/django/contrib/admin/templates/admin/ templates/django_admin
  75.      
  76. ~/virtualenvs/mydomain/lib/python2.7/site-packages/django/contrib/admin/templates/admin
  77.      
  78. /templates/
  79.    admin
  80.    admin_src -> [to django source]
  81.    base.html
  82.    index.html
  83.    sitemap.xml
  84.    etc...
  85.      
  86. {% extends "admin_src/base.html" %}
  87.  
  88. {% block extrahead %}
  89. <link rel='shortcut icon' href='{{ STATIC_URL }}img/favicon-admin.ico' />
  90. {% endblock %}
  91.      
  92. admin.site.index_template = 'admin/custom_index.html'
  93.      
  94. admin.AdminSite.app_index_template = "servers/servers-home.html"
  95.      
  96. change_list_template = "servers/servers_changelist.html"
  97.      
  98. change_form_template = "servers/server_changeform.html"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top