夹层更改管理员的历史记录

时间:2017-02-02 10:37:52

标签: python django mezzanine

在管理面板中,页面的更改历史记录显示不正确。

它显示了一些像原始数据的东西而不是描述变化,例如:

from __future__ import absolute_import, unicode_literals
import os

from django import VERSION as DJANGO_VERSION
from django.utils.translation import ugettext_lazy as _


######################
# MEZZANINE SETTINGS #
######################

ADMIN_REMOVAL = (
    "mezzanine.generic.models.ThreadedComment ",
    "mezzanine.pages.models.Link",
    "mezzanine.forms.models.Form",
    "mezzanine.galleries.models.Gallery",
)

PAGE_MENU_TEMPLATES = ()

USE_MODELTRANSLATION = False


########################
# MAIN DJANGO SETTINGS #
########################

SECRET_KEY = <some_data>
NEVERCACHE_KEY = <some_data>

ALLOWED_HOSTS = ['localhost', '127.0.0.1']

FILEBROWSER_EXTENSIONS = {
    'Image': ['.JPG', '.JPEG', '.GIF', '.PNG', '.TIF', '.TIFF'],
}

TIME_ZONE = 'Asia/Yekaterinburg'

USE_TZ = False

LANGUAGE_CODE = "ru"

LANGUAGES = (('ru', _('Russian')),)

DEBUG = True

SESSION_EXPIRE_AT_BROWSER_CLOSE = True

SITE_ID = 1

USE_I18N = True

AUTHENTICATION_BACKENDS = ("mezzanine.core.auth_backends.MezzanineBackend",)

FILE_UPLOAD_PERMISSIONS = 0o644


#############
# DATABASES #
#############

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": "dev.db",
        "USER": "",
        "PASSWORD": "",
        "HOST": "",
        "PORT": "",
    }
}


#########
# PATHS #
#########

PROJECT_APP_PATH = os.path.dirname(os.path.abspath(__file__))
PROJECT_APP = os.path.basename(PROJECT_APP_PATH)
PROJECT_ROOT = BASE_DIR = os.path.dirname(PROJECT_APP_PATH)

CACHE_MIDDLEWARE_KEY_PREFIX = PROJECT_APP

STATIC_URL = "/static/"

STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/"))

MEDIA_URL = "/media/"

MEDIA_ROOT = os.path.join(PROJECT_ROOT, MEDIA_URL.strip("/"))

ROOT_URLCONF = "%s.urls" % PROJECT_APP

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [
            os.path.join(PROJECT_ROOT, "templates")
        ],
        "APP_DIRS": True,
        "OPTIONS": {
            "context_processors": [
                "django.contrib.auth.context_processors.auth",
                "django.contrib.messages.context_processors.messages",
                "django.template.context_processors.debug",
                "django.template.context_processors.i18n",
                "django.template.context_processors.static",
                "django.template.context_processors.media",
                "django.template.context_processors.request",
                "django.template.context_processors.tz",
                "mezzanine.conf.context_processors.settings",
                "mezzanine.pages.context_processors.page",
            ],
            "builtins": [
                "mezzanine.template.loader_tags",
            ],
        },
    },
]

if DJANGO_VERSION < (1, 9):
    del TEMPLATES[0]["OPTIONS"]["builtins"]


################
# APPLICATIONS #
################

INSTALLED_APPS = (
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.redirects",
    "django.contrib.sessions",
    "django.contrib.sites",
    "django.contrib.sitemaps",
    "django.contrib.staticfiles",
    "mezzanine.boot",
    "mezzanine.conf",
    "mezzanine.core",
    "mezzanine.generic",
    "mezzanine.pages",
    "mezzanine.forms",
    "mezzanine.galleries",
)

MIDDLEWARE_CLASSES = (
    "mezzanine.core.middleware.UpdateCacheMiddleware",

    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

    "mezzanine.core.request.CurrentRequestMiddleware",
    "mezzanine.core.middleware.RedirectFallbackMiddleware",
    "mezzanine.core.middleware.TemplateForDeviceMiddleware",
    "mezzanine.core.middleware.TemplateForHostMiddleware",
    "mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware",
    "mezzanine.core.middleware.SitePermissionMiddleware",
    "mezzanine.pages.middleware.PageMiddleware",
    "mezzanine.core.middleware.FetchFromCacheMiddleware",
)

PACKAGE_NAME_FILEBROWSER = "filebrowser_safe"
PACKAGE_NAME_GRAPPELLI = "grappelli_safe"


#########################
# OPTIONAL APPLICATIONS #
#########################

# These will be added to ``INSTALLED_APPS``, only if available.
OPTIONAL_APPS = (
    "debug_toolbar",
    "django_extensions",
    "compressor",
    PACKAGE_NAME_FILEBROWSER,
    PACKAGE_NAME_GRAPPELLI,
)


##################
# LOCAL SETTINGS #
##################

f = os.path.join(PROJECT_APP_PATH, "local_settings.py")
if os.path.exists(f):
    import sys
    import imp
    module_name = "%s.local_settings" % PROJECT_APP
    module = imp.new_module(module_name)
    module.__file__ = f
    sys.modules[module_name] = module
    exec(open(f, "rb").read())


####################
# DYNAMIC SETTINGS #
####################

try:
    from mezzanine.utils.conf import set_dynamic_settings
except ImportError:
    pass
else:
    set_dynamic_settings(globals())

您是否知道以下代码有什么问题?

谢谢,

以下设置文件:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap btn-tool</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <style>
    .labelarrange1{
        float:left;
        position:relative;
        left:5px;
        top:8px;
        font-size:10px;
    }

    .btn{
        border-radius:0;
        background:powderblue;
        border-radius:0;
    }
  </style>
</head>
<body>

<div class="btn-toolbar container" role="toolbar" aria-label="Toolbar with button groups">
  <div class="row">
      <div class="col-md-1">
          <label class="labelarrange1">Relay 1</label>
          <br>
          <button type="button" class="btn btn-lg">A</button>
      </div>

      <div class="col-md-1">
          <label class="labelarrange1">Relay 1</label>
          <br>
          <button type="button" class="btn btn-lg">A</button>
      </div>

      <div class="col-md-1">
          <label class="labelarrange1">Relay 3</label>
          <br>
          <button type="button" class="btn btn-lg" style="background:#eee;">O</button>
      </div>
  </div>



</div>
</body>
</html>

0 个答案:

没有答案