django models / admin issue - admin显示两次表

时间:2017-03-08 11:39:17

标签: python django database django-models django-admin

我们将django模型从一个应用程序移动到另一个应用程序(" PollRunForJira"已从#34;报告"移至" jira_fat")。

旧模型中的所有代码看起来都很干净,并且django_migrations数据库表也是旧模型的干净。

django admin仍显示2个型号: enter image description here

这是新模型的admin.py:

from django.contrib import admin  
from jira_fat.models import PollRunForJira

@admin.register(PollRunForJira)
class RunJiraAdmin(admin.ModelAdmin):
    list_display = [f.name for f in PollRunForJira._meta.fields]
    search_fields = [f.name for f in PollRunForJira._meta.fields]

在尝试访问旧模型管理页面时,这里是堆栈跟踪:



ProgrammingError at /admin/reports/pollrunforjira/
relation "fat_poll_run_for_jira" does not exist
LINE 1: SELECT COUNT(*) AS "__count" FROM "fat_poll_run_for_jira"
                                          ^
Request Method:	GET
Request URL:	http://vd-yanayt:8000/admin/reports/pollrunforjira/
Django Version:	1.10.4
Exception Type:	ProgrammingError
Exception Value:	
relation "fat_poll_run_for_jira" does not exist
LINE 1: SELECT COUNT(*) AS "__count" FROM "fat_poll_run_for_jira"
                                          ^
Exception Location:	/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/backends/utils.py in execute, line 64
Python Executable:	/home/yanayt/envs/py2.7/bin/python
Python Version:	2.7.5
Python Path:	
['/home/yanayt/dev/fat/fatsite/run',
 '/home/yanayt/dev/fat/fatsite',
 '/home/yanayt/dev/fat/fatsite',
 '/home/yanayt/dev/gitlab-fw',
 '/home/yanayt/dev/fat',
 '/home/yanayt/dev/gitlab-fw/modules',
 '/home/yanayt/dev/fat/tests_and_pocs/neural_project',
 '/home/yanayt/envs/py2.7/lib64/python27.zip',
 '/home/yanayt/envs/py2.7/lib64/python2.7',
 '/home/yanayt/envs/py2.7/lib64/python2.7/plat-linux2',
 '/home/yanayt/envs/py2.7/lib64/python2.7/lib-tk',
 '/home/yanayt/envs/py2.7/lib64/python2.7/lib-old',
 '/home/yanayt/envs/py2.7/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7',
 '/usr/lib/python2.7',
 '/home/yanayt/envs/py2.7/lib/python2.7/site-packages']
Server time:	Thu, 9 Mar 2017 08:25:11 +0000
Traceback Switch to copy-and-paste view

/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/core/handlers/exception.py in inner
            response = get_response(request) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/core/handlers/base.py in _get_response
                response = self.process_exception_by_middleware(e, request) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/core/handlers/base.py in _get_response
                response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/contrib/admin/options.py in wrapper
                return self.admin_site.admin_view(view)(*args, **kwargs) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/utils/decorators.py in _wrapped_view
                    response = view_func(request, *args, **kwargs) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/views/decorators/cache.py in _wrapped_view_func
        response = view_func(request, *args, **kwargs) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/contrib/admin/sites.py in inner
            return view(request, *args, **kwargs) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/utils/decorators.py in _wrapper
            return bound_func(*args, **kwargs) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/utils/decorators.py in _wrapped_view
                    response = view_func(request, *args, **kwargs) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/utils/decorators.py in bound_func
                return func.__get__(self, type(self))(*args2, **kwargs2) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/contrib/admin/options.py in changelist_view
                self.list_max_show_all, self.list_editable, self, ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/contrib/admin/views/main.py in __init__
        self.get_results(request) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/contrib/admin/views/main.py in get_results
        result_count = paginator.count ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/utils/functional.py in __get__
        res = instance.__dict__[self.name] = self.func(instance) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/core/paginator.py in count
            return self.object_list.count() ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/models/query.py in count
        return self.query.get_count(using=self.db) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/models/sql/query.py in get_count
        number = obj.get_aggregation(using, ['__count'])['__count'] ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/models/sql/query.py in get_aggregation
        result = compiler.execute_sql(SINGLE) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/models/sql/compiler.py in execute_sql
            cursor.execute(sql, params) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/backends/utils.py in execute
            return super(CursorDebugWrapper, self).execute(sql, params) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/backends/utils.py in execute
                return self.cursor.execute(sql, params) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/utils.py in __exit__
                six.reraise(dj_exc_type, dj_exc_value, traceback) ...
▶ Local vars
/home/yanayt/envs/py2.7/lib/python2.7/site-packages/django/db/backends/utils.py in execute
                return self.cursor.execute(sql, params) ...
▶ Local vars
Request information

USER
ramia
GET
No GET data
POST
No POST data
FILES
No FILES data
COOKIES
Variable	Value
csrftoken	
'V9GLLP65GqsOtO3BIaD2gcEzVC2FWR1bHbOTnOLGoYpEnImHfaZuAyurnSJ9TDPJ'
sessionid	
'tadzkbmrwyl3ifymz8mwmpzl2vntxwl6'
META
Variable	Value
CONTENT_LENGTH	
''
CONTENT_TYPE	
'text/plain'
CSRF_COOKIE	
'V9GLLP65GqsOtO3BIaD2gcEzVC2FWR1bHbOTnOLGoYpEnImHfaZuAyurnSJ9TDPJ'
CVS_RSH	
'ssh'
DBUS_SESSION_BUS_ADDRESS	
'unix:abstract=/tmp/dbus-k3hJr68Azw,guid=1044caba22e2b060c5fcd9ce58b57f82'
DESKTOP_SESSION	
'gnome-classic'
DESKTOP_STARTUP_ID	
'nautilus-5335-vd-yanayt.xiolab.lab.emc.com-/home/yanayt/pycharm-2016.1.4/bin/pycharm.sh-1_TIME359902'
DISPLAY	
':1.0'
DJANGO_SETTINGS_MODULE	
'config.settings'
DJ_DEBUG	
'true'
EDITOR	
'vim'
ESDAUTH	
'/var/opt/thinlinc/sessions/yanayt/1/esd_auth'
ESPEAKER	
'127.0.0.1:4910'
GATEWAY_INTERFACE	
'CGI/1.1'
GIO_LAUNCHED_DESKTOP_FILE	
'/home/yanayt/Desktop/PC.desktop'
GIO_LAUNCHED_DESKTOP_FILE_PID	
'6435'
GNOME_DESKTOP_SESSION_ID	
'this-is-deprecated'
GNOME_SHELL_SESSION_MODE	
'classic'
GPG_AGENT_INFO	
'/run/user/1418/keyring/gpg:0:1'
HISTCONTROL	
'ignoredups:erasedups'
HISTSIZE	
'1000'
HOME	
'/home/yanayt'
HOSTNAME	
'vd-yanayt.xiolab.lab.emc.com'
HTTP_ACCEPT	
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
HTTP_ACCEPT_ENCODING	
'gzip, deflate, sdch'
HTTP_ACCEPT_LANGUAGE	
'en-US,en;q=0.8,he;q=0.6'
HTTP_CACHE_CONTROL	
'max-age=0'
HTTP_CONNECTION	
'keep-alive'
HTTP_COOKIE	
'csrftoken=V9GLLP65GqsOtO3BIaD2gcEzVC2FWR1bHbOTnOLGoYpEnImHfaZuAyurnSJ9TDPJ; sessionid=tadzkbmrwyl3ifymz8mwmpzl2vntxwl6'
HTTP_HOST	
'vd-yanayt:8000'
HTTP_REFERER	
'http://vd-yanayt:8000/admin/login/?next=/admin/reports/pollrunforjira/'
HTTP_UPGRADE_INSECURE_REQUESTS	
'1'
HTTP_USER_AGENT	
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
KDEDIRS	
'/usr'
KRB5CCNAME	
'/var/opt/thinlinc/sessions/yanayt/1/krb5cc'
LANG	
'en_US.UTF-8'
LD_LIBRARY_PATH	
'/home/yanayt/pycharm-2016.1.4/bin:/opt/thinlinc/lib64:/opt/thinlinc/lib'
LESSOPEN	
'||/usr/bin/lesspipe.sh %s'
LOGNAME	
'yanayt'
MAIL	
'/var/spool/mail/yanayt'
NLSPATH	
'/usr/dt/lib/nls/msg/%L/%N.cat'
PATH	
'/home/yanayt/envs/py2.7/bin:/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/opt/thinlinc/bin:/usr/local/bin:/usr/bin/X11:/usr/dt/bin:/usr/openwin/bin:/sbin:/usr/sbin:/usr/local/sbin:/home/yanayt/bin'
PATH_INFO	
u'/admin/reports/pollrunforjira/'
PCSCTUN_COOKIE	
'/var/opt/thinlinc/sessions/yanayt/1/pcsctun-cookie'
PCSCTUN_SERVER	
'127.0.0.1:4916'
PULSE_COOKIE	
'/var/opt/thinlinc/sessions/yanayt/1/pulse-cookie'
PULSE_SERVER	
'127.0.0.1:4915'
PWD	
'/home/yanayt'
PYCHARM_HOSTED	
'1'
PYTHONIOENCODING	
'UTF-8'
PYTHONPATH	
'/home/yanayt/dev/fat/fatsite:/home/yanayt/dev/gitlab-fw:/home/yanayt/dev/fat:/home/yanayt/dev/gitlab-fw/modules:/home/yanayt/dev/fat/tests_and_pocs/neural_project'
PYTHONUNBUFFERED	
'1'
QTDIR	
'/usr/lib64/qt-3.3'
QTINC	
'/usr/lib64/qt-3.3/include'
QTLIB	
'/usr/lib64/qt-3.3/lib'
QT_GRAPHICSSYSTEM_CHECKED	
'1'
QT_IM_MODULE	
'ibus'
QT_PLUGIN_PATH	
'/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins'
QUERY_STRING	
''
REMOTE_ADDR	
'10.76.50.168'
REMOTE_HOST	
''
REQUEST_METHOD	
'GET'
RUN_MAIN	
'true'
SCRIPT_NAME	
u''
SERVER_NAME	
'vd-yanayt.xiolab.lab.emc.com'
SERVER_PORT	
'8000'
SERVER_PROTOCOL	
'HTTP/1.1'
SERVER_SOFTWARE	
'WSGIServer/0.1 Python/2.7.5'
SESSION_MANAGER	
'local/unix:@/tmp/.ICE-unix/5162,unix/unix:/tmp/.ICE-unix/5162'
SHELL	
'/bin/bash'
SHLVL	
'2'
SSH_ASKPASS	
'/usr/libexec/openssh/gnome-ssh-askpass'
SSH_AUTH_SOCK	
'/run/user/1418/keyring/ssh'
TLPREFIX	
'/opt/thinlinc'
TLPROFILE	
'gnome-classic'
TLSESSIONDATA	
'/var/opt/thinlinc/sessions/yanayt/1'
TOWN	
'Springfield'
TZ	
'UTC'
USER	
'yanayt'
USERNAME	
'yanayt'
VIRTUAL_ENV	
'/home/yanayt/envs/py2.7'
XAUTHORITY	
'/var/opt/thinlinc/sessions/yanayt/1/Xauthority'
XDG_CURRENT_DESKTOP	
'GNOME-Classic:GNOME'
XDG_MENU_PREFIX	
'gnome-'
XDG_RUNTIME_DIR	
'/run/user/1418'
XDG_SESSION_CLASS	
'user'
XDG_SESSION_DESKTOP	
'gnome-classic'
XDG_SESSION_ID	
'6'
XDG_SESSION_TYPE	
'x11'
XFILESEARCHPATH	
'/usr/dt/app-defaults/%L/Dt'
XMODIFIERS	
'@im=ibus'
_	
'/home/yanayt/pycharm-2016.1.4/bin/../jre/jre/bin/java'
wsgi.errors	
<open file '<stderr>', mode 'w' at 0x7fe3940171e0>
wsgi.file_wrapper	
''
wsgi.input	
<socket._fileobject object at 0x7fe362dfd6d0>
wsgi.multiprocess	
False
wsgi.multithread	
True
wsgi.run_once	
False
wsgi.url_scheme	
'http'
wsgi.version	
(1, 0)
Settings
Using settings module config.settings
Setting	Value
ABSOLUTE_URL_OVERRIDES	
{}
ADMINS	
[]
ALLOWED_HOSTS	
['*']
APPEND_SLASH	
True
AUTHENTICATION_BACKENDS	
('django.contrib.auth.backends.ModelBackend',
 'auth_fat.fat_ldap.LDAPBackendLAB',
 'auth_fat.fat_ldap.LDAPBackendCORP')
AUTH_LDAP_CORP_ALWAYS_UPDATE_USER	
True
AUTH_LDAP_CORP_SERVER_URI	
'ldap://corpishz2.corp.emc.com'
AUTH_LDAP_CORP_USER_ATTR_MAP	
{'email': 'mail', 'first_name': 'givenName', 'last_name': 'sn'}
AUTH_LDAP_CORP_USER_DN_TEMPLATE	
'corp\\%(user)s'
AUTH_LDAP_CORP_USER_SEARCH	
<django_auth_ldap.config.LDAPSearchUnion object at 0x1d9da90>
AUTH_LDAP_LAB_ALWAYS_UPDATE_USER	
True
AUTH_LDAP_LAB_BIND_DN	
'uid=xiolabit1,cn=config'
AUTH_LDAP_LAB_BIND_PASSWORD	
u'********************'
AUTH_LDAP_LAB_SERVER_URI	
'ldap://ldap.xioeng.lab.emc.com'
AUTH_LDAP_LAB_USER_ATTR_MAP	
{'email': 'mail', 'first_name': 'givenName', 'last_name': 'sn'}
AUTH_LDAP_LAB_USER_SEARCH	
<django_auth_ldap.config.LDAPSearchUnion object at 0x1d9d950>
AUTH_PASSWORD_VALIDATORS	
u'********************'
AUTH_USER_MODEL	
u'auth.User'
BASE_DIR	
'/home/yanayt/dev/fat/fatsite'
CACHES	
{'default': {'BACKEND': 'django_redis.cache.RedisCache',
             'LOCATION': 'redis://127.0.0.1:6379/0',
             'OPTIONS': {'CLIENT_CLASS': 'django_redis.client.DefaultClient'}}}
CACHE_BACKEND	
'redis_cache.cache://localhost:6379'
CACHE_MIDDLEWARE_ALIAS	
u'default'
CACHE_MIDDLEWARE_KEY_PREFIX	
u'********************'
CACHE_MIDDLEWARE_SECONDS	
600
CSRF_COOKIE_AGE	
31449600
CSRF_COOKIE_DOMAIN	
None
CSRF_COOKIE_HTTPONLY	
False
CSRF_COOKIE_NAME	
u'csrftoken'
CSRF_COOKIE_PATH	
u'/'
CSRF_COOKIE_SECURE	
False
CSRF_FAILURE_VIEW	
u'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME	
u'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS	
[]
DATABASES	
{'default': {'ATOMIC_REQUESTS': False,
             'AUTOCOMMIT': True,
             'CONN_MAX_AGE': 0,
             'ENGINE': 'django.db.backends.postgresql_psycopg2',
             'HOST': '127.0.0.1',
             'NAME': 'fat_ng_db',
             'OPTIONS': {},
             'PASSWORD': u'********************',
             'PORT': '',
             'TEST': {'CHARSET': None,
                      'COLLATION': None,
                      'MIRROR': None,
                      'NAME': None},
             'TIME_ZONE': None,
             'USER': 'xadmin'}}
DATABASE_ROUTERS	
[]
DATA_UPLOAD_MAX_MEMORY_SIZE	
2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS	
1000
DATETIME_FORMAT	
u'N j, Y, P'
DATETIME_INPUT_FORMATS	
[u'%Y-%m-%d %H:%M:%S',
 u'%Y-%m-%d %H:%M:%S.%f',
 u'%Y-%m-%d %H:%M',
 u'%Y-%m-%d',
 u'%m/%d/%Y %H:%M:%S',
 u'%m/%d/%Y %H:%M:%S.%f',
 u'%m/%d/%Y %H:%M',
 u'%m/%d/%Y',
 u'%m/%d/%y %H:%M:%S',
 u'%m/%d/%y %H:%M:%S.%f',
 u'%m/%d/%y %H:%M',
 u'%m/%d/%y']
DATE_FORMAT	
u'N j, Y'
DATE_INPUT_FORMATS	
[u'%Y-%m-%d',
 u'%m/%d/%Y',
 u'%m/%d/%y',
 u'%b %d %Y',
 u'%b %d, %Y',
 u'%d %b %Y',
 u'%d %b, %Y',
 u'%B %d %Y',
 u'%B %d, %Y',
 u'%d %B %Y',
 u'%d %B, %Y']
DATE_TIME_FORMAT	
'%Y-%m-%d %H:%M:%S'
DEBUG	
True
DEBUG_PROPAGATE_EXCEPTIONS	
False
DECIMAL_SEPARATOR	
u'.'
DEFAULT_CHARSET	
u'utf-8'
DEFAULT_CONTENT_TYPE	
u'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER	
u'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE	
u'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL	
u'webmaster@localhost'
DEFAULT_INDEX_TABLESPACE	
u''
DEFAULT_LOG_PATH	
'/var/log/fat/fat-log.txt'
DEFAULT_TABLESPACE	
u''
DISALLOWED_USER_AGENTS	
[]
EMAIL_BACKEND	
u'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST	
u'localhost'
EMAIL_HOST_PASSWORD	
u'********************'
EMAIL_HOST_USER	
u''
EMAIL_PORT	
25
EMAIL_SSL_CERTFILE	
None
EMAIL_SSL_KEYFILE	
u'********************'
EMAIL_SUBJECT_PREFIX	
u'[Django] '
EMAIL_TIMEOUT	
None
EMAIL_USE_SSL	
False
EMAIL_USE_TLS	
False
FILE_CHARSET	
u'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS	
None
FILE_UPLOAD_HANDLERS	
[u'django.core.files.uploadhandler.MemoryFileUploadHandler',
 u'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE	
2621440
FILE_UPLOAD_PERMISSIONS	
None
FILE_UPLOAD_TEMP_DIR	
None
FIRST_DAY_OF_WEEK	
0
FIXTURE_DIRS	
[]
FORCE_SCRIPT_NAME	
None
FORMAT_MODULE_PATH	
None
IGNORABLE_404_URLS	
[]
INSTALLED_APPS	
['redis_cache',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'fixture_magic',
 'auth_fat',
 'api',
 'client',
 'main_pages',
 'dir_listener',
 'analysis_retention',
 'run',
 'activities',
 'original_log',
 'reports',
 'jira_fat',
 'django_rq',
 'django_rq_dashboard',
 'scheduler',
 'daterange_filter']
INTERNAL_IPS	
[]
IS_DEBUG_TOOLBAR	
False
LANGUAGES	
[(u'af', u'Afrikaans'),
 (u'ar', u'Arabic'),
 (u'ast', u'Asturian'),
 (u'az', u'Azerbaijani'),
 (u'bg', u'Bulgarian'),
 (u'be', u'Belarusian'),
 (u'bn', u'Bengali'),
 (u'br', u'Breton'),
 (u'bs', u'Bosnian'),
 (u'ca', u'Catalan'),
 (u'cs', u'Czech'),
 (u'cy', u'Welsh'),
 (u'da', u'Danish'),
 (u'de', u'German'),
 (u'dsb', u'Lower Sorbian'),
 (u'el', u'Greek'),
 (u'en', u'English'),
 (u'en-au', u'Australian English'),
 (u'en-gb', u'British English'),
 (u'eo', u'Esperanto'),
 (u'es', u'Spanish'),
 (u'es-ar', u'Argentinian Spanish'),
 (u'es-co', u'Colombian Spanish'),
 (u'es-mx', u'Mexican Spanish'),
 (u'es-ni', u'Nicaraguan Spanish'),
 (u'es-ve', u'Venezuelan Spanish'),
 (u'et', u'Estonian'),
 (u'eu', u'Basque'),
 (u'fa', u'Persian'),
 (u'fi', u'Finnish'),
 (u'fr', u'French'),
 (u'fy', u'Frisian'),
 (u'ga', u'Irish'),
 (u'gd', u'Scottish Gaelic'),
 (u'gl', u'Galician'),
 (u'he', u'Hebrew'),
 (u'hi', u'Hindi'),
 (u'hr', u'Croatian'),
 (u'hsb', u'Upper Sorbian'),
 (u'hu', u'Hungarian'),
 (u'ia', u'Interlingua'),
 (u'id', u'Indonesian'),
 (u'io', u'Ido'),
 (u'is', u'Icelandic'),
 (u'it', u'Italian'),
 (u'ja', u'Japanese'),
 (u'ka', u'Georgian'),
 (u'kk', u'Kazakh'),
 (u'km', u'Khmer'),
 (u'kn', u'Kannada'),
 (u'ko', u'Korean'),
 (u'lb', u'Luxembourgish'),
 (u'lt', u'Lithuanian'),
 (u'lv', u'Latvian'),
 (u'mk', u'Macedonian'),
 (u'ml', u'Malayalam'),
 (u'mn', u'Mongolian'),
 (u'mr', u'Marathi'),
 (u'my', u'Burmese'),
 (u'nb', u'Norwegian Bokm\xe5l'),
 (u'ne', u'Nepali'),
 (u'nl', u'Dutch'),
 (u'nn', u'Norwegian Nynorsk'),
 (u'os', u'Ossetic'),
 (u'pa', u'Punjabi'),
 (u'pl', u'Polish'),
 (u'pt', u'Portuguese'),
 (u'pt-br', u'Brazilian Portuguese'),
 (u'ro', u'Romanian'),
 (u'ru', u'Russian'),
 (u'sk', u'Slovak'),
 (u'sl', u'Slovenian'),
 (u'sq', u'Albanian'),
 (u'sr', u'Serbian'),
 (u'sr-latn', u'Serbian Latin'),
 (u'sv', u'Swedish'),
 (u'sw', u'Swahili'),
 (u'ta', u'Tamil'),
 (u'te', u'Telugu'),
 (u'th', u'Thai'),
 (u'tr', u'Turkish'),
 (u'tt', u'Tatar'),
 (u'udm', u'Udmurt'),
 (u'uk', u'Ukrainian'),
 (u'ur', u'Urdu'),
 (u'vi', u'Vietnamese'),
 (u'zh-hans', u'Simplified Chinese'),
 (u'zh-hant', u'Traditional Chinese')]
LANGUAGES_BIDI	
[u'he', u'ar', u'fa', u'ur']
LANGUAGE_CODE	
'en-us'
LANGUAGE_COOKIE_AGE	
None
LANGUAGE_COOKIE_DOMAIN	
None
LANGUAGE_COOKIE_NAME	
u'django_language'
LANGUAGE_COOKIE_PATH	
u'/'
LOCALE_PATHS	
[]
LOGGING	
{'disable_existing_loggers': False,
 'formatters': {'simple': {'datefmt': '%Y-%m-%d %H:%M:%S',
                           'format': '[%(levelname)-7s] %(asctime)s - %(message)s'},
                'verbose': {'datefmt': '%Y-%m-%d %H:%M:%S',
                            'format': '%(asctime)s - %(levelname)s - %(process)d - %(thread)d - %(filename)s - %(message)s'}},
 'handlers': {'console': {'class': 'logging.StreamHandler',
                          'formatter': 'verbose',
                          'level': 'DEBUG'},
              'fat_app_logfile': {'backupCount': 8,
                                  'class': 'cloghandler.ConcurrentRotatingFileHandler',
                                  'filename': '/var/log/fat/fat-log.txt',
                                  'formatter': 'verbose',
                                  'level': 'DEBUG',
                                  'maxBytes': 1048576},
              'rq_app_logfile': {'backupCount': 8,
                                 'class': 'cloghandler.ConcurrentRotatingFileHandler',
                                 'filename': '/var/log/fat/fat-log.txt',
                                 'formatter': 'verbose',
                                 'level': 'DEBUG',
                                 'maxBytes': 1048576}},
 'loggers': {'MainLogger': {'handlers': ['console', 'fat_app_logfile'],
                            'level': 'DEBUG',
                            'propagate': True},
             'django_auth_ldap': {'handlers': ['console', 'fat_app_logfile'],
                                  'level': 'DEBUG',
                                  'propagate': True},
             'rq_scheduler': {'handlers': ['console', 'fat_app_logfile'],
                              'level': 'DEBUG',
                              'propagate': True}},
 'version': 1}
LOGGING_CONFIG	
u'logging.config.dictConfig'
LOGIN_REDIRECT_URL	
'/'
LOGIN_URL	
u'/accounts/login/'
LOGOUT_REDIRECT_URL	
None
LOG_FILENAME	
'fat-log.txt'
LOG_FILES_ROTATE_NUM	
8
LOG_FILE_FULL_PATH	
'/var/log/fat/fat-log.txt'
LOG_FILE_MAX_SIZE_MB	
1
MANAGERS	
[]
MEDIA_ROOT	
u''
MEDIA_URL	
u''
MESSAGE_STORAGE	
u'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE	
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'config.nocache.NoCache']
MIDDLEWARE_CLASSES	
[u'django.middleware.common.CommonMiddleware',
 u'django.middleware.csrf.CsrfViewMiddleware']
MIGRATION_MODULES	
{}
MONTH_DAY_FORMAT	
u'F j'
NUMBER_GROUPING	
0
PASSWORD_HASHERS	
u'********************'
PASSWORD_RESET_TIMEOUT_DAYS	
u'********************'
PREPEND_WWW	
False
PROJECT_PATH	
'/home/yanayt/dev/fat/fatsite'
ROOT_URLCONF	
'config.urls'
RQ_QUEUES	
{'default': {'USE_REDIS_CACHE': 'default'},
 'scheduled_jobs': {'USE_REDIS_CACHE': 'default'}}
SECRET_KEY	
u'********************'
SECURE_BROWSER_XSS_FILTER	
False
SECURE_CONTENT_TYPE_NOSNIFF	
False
SECURE_HSTS_INCLUDE_SUBDOMAINS	
False
SECURE_HSTS_SECONDS	
0
SECURE_PROXY_SSL_HEADER	
None
SECURE_REDIRECT_EXEMPT	
[]
SECURE_SSL_HOST	
None
SECURE_SSL_REDIRECT	
False
SERVER_EMAIL	
u'root@localhost'
SESSION_CACHE_ALIAS	
'default'
SESSION_COOKIE_AGE	
1209600
SESSION_COOKIE_DOMAIN	
None
SESSION_COOKIE_HTTPONLY	
True
SESSION_COOKIE_NAME	
u'sessionid'
SESSION_COOKIE_PATH	
u'/'
SESSION_COOKIE_SECURE	
False
SESSION_ENGINE	
'django.contrib.sessions.backends.cache'
SESSION_EXPIRE_AT_BROWSER_CLOSE	
False
SESSION_FILE_PATH	
None
SESSION_SAVE_EVERY_REQUEST	
False
SESSION_SERIALIZER	
u'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE	
'config.settings'
SHORT_DATETIME_FORMAT	
u'm/d/Y P'
SHORT_DATE_FORMAT	
u'm/d/Y'
SIGNING_BACKEND	
u'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS	
[]
SIMPLE_LINE_FORMAT	
'[%(levelname)-7s] %(asctime)s - %(message)s'
SITE_ROOT	
'/home/yanayt/dev/fat/fatsite'
STATICFILES_DIRS	
['/home/yanayt/dev/fat/fatsite/static']
STATICFILES_FINDERS	
[u'django.contrib.staticfiles.finders.FileSystemFinder',
 u'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE	
u'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT	
'/var/www/static'
STATIC_URL	
'/static/'
TEMPLATES	
[{'APP_DIRS': True,
  'BACKEND': 'django.template.backends.django.DjangoTemplates',
  'DIRS': ['/home/yanayt/dev/fat/fatsite/templates',
           '/home/yanayt/dev/fat/fatsite/static'],
  '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']}}]
TEST_NON_SERIALIZED_APPS	
[]
TEST_RUNNER	
u'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR	
u','
TIME_FORMAT	
u'P'
TIME_INPUT_FORMATS	
[u'%H:%M:%S', u'%H:%M:%S.%f', u'%H:%M']
TIME_ZONE	
'UTC'
USE_ETAGS	
False
USE_I18N	
True
USE_L10N	
True
USE_THOUSAND_SEPARATOR	
False
USE_TZ	
True
USE_X_FORWARDED_HOST	
False
USE_X_FORWARDED_PORT	
False
VERBOSE_LINE_FORMAT	
'%(asctime)s - %(levelname)s - %(process)d - %(thread)d - %(filename)s - %(message)s'
WSGI_APPLICATION	
'config.wsgi.application'
X_FRAME_OPTIONS	
u'SAMEORIGIN'
YEAR_MONTH_FORMAT	
u'F Y'
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.
&#13;
&#13;
&#13;

新模型功能正常(我们可以在管理员中钻取它#34;虽然旧模型出现但我们无法钻进它。

如何摆脱管理员中的旧模型显示? Django从哪里获取信息,如果它没有出现在代码/ DB中。

由于

2 个答案:

答案 0 :(得分:0)

admin.py内,您宣布将向管理员注册的模型。检查并删除它!

答案 1 :(得分:0)

事实证明,DB表django-content-type包含旧模型和新模型。 因此需要采取两项行动:

  1. 更新auth_permission表以指向django-content-type表中的新模型条目。
  2. 删除django-content-type表中的旧模型条目。
  3. 干杯