django - 如何更改文本“感谢您今天在网站上度过了美好的时光”。在姜戈?
问题描述
当您注销 Django 管理员时,它会显示一个字符串“感谢您今天在网站上度过了美好的时光”。
我可以把它改成别的吗?
我能够更改其他属性,例如
admin.site.site_header = "Whatever"
admin.site.site_title = "Whatever"
admin.site.index_title = "Whatever"
在 urls.py 文件中效果很好,所以我猜这可以类似地改变。
谢谢你的帮助。尝试谷歌,没有骰子。
解决方案
You can change the text by using the following steps:-
Step:-1 In your settings.py file in the 'TEMPLATES' section, give path of your templates directory created by you for overridding the logged_out.html template file.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates'], // path of your templates folder
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
Step:-2 create a directory 'registration' in your templates folder.
Step:-3 Now create 'logged_out.html' file in registration folder.
Step:-4 Change the content according to you requirement
logged_out.html
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="{% url 'admin:index' %}">{% translate 'Home' %}</a></div>{% endblock %}
{% block nav-sidebar %}{% endblock %}
{% block content %}
<p>{% translate "Thanks for spending some quality time with the Web site today." %}</p>
<p><a href="{% url 'admin:index' %}">{% translate 'Log in again' %}</a></p>
{% endblock %}
推荐阅读
- php - 用于 php 7.0 的 PostgreSQL PDO 驱动程序
- openshift - 如何在命令提示符 Mac 中在线运行 openshift
- ios - pushViewController 时禁用导航栏透明度
- android - 牛津词典 Api 通过 EditText 搜索单词
- reactjs - Azure多个应用程序与反应,在浏览器中加载反应后无法访问其他应用程序
- excel - 具有动态范围的 VBA VLOOKUP
- php - Invision 电源板错误
- node.js - 使用 Jest 和 Mongoose 进行快速 API 测试
- asp.net-core - Autofac 和 Automapper - 已注册但未解析的配置文件
- java - 构造函数 Scanner(InputStream) 未定义