Извините. Эта ошибка сводит меня с ума. Я только что обновил с Django 1.11 до 2.0 и не могу отследить эту простую ошибку приведения.
В трассировке не упоминается ни одна часть моего кода ...
Я знаю, что означает ошибка. Я просто не могу найти, где проблема в моем коде.
Эта ошибка возникает при создании или редактировании записи. Через оболочку я могу создать объект просто отлично.
Трассировка:
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner
35. response = get_response(request)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/admin/options.py" in wrapper
574. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/admin/sites.py" in inner
223. return view(request, *args, **kwargs)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/admin/options.py" in change_view
1556. return self.changeform_view(request, object_id, form_url, extra_context)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapper
62. return bound_func(*args, **kwargs)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/utils/decorators.py" in bound_func
58. return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/admin/options.py" in changeform_view
1450. return self._changeform_view(request, object_id, form_url, extra_context)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/admin/options.py" in _changeform_view
1498. return self.response_change(request, new_object)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/admin/options.py" in response_change
1239. self.message_user(request, msg, messages.SUCCESS)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/admin/options.py" in message_user
1013. messages.add_message(request, level, message, extra_tags=extra_tags, fail_silently=fail_silently)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/messages/api.py" in add_message
34. return messages.add(level, message, extra_tags)
File "/home/rodrigo/Workspace/VirtualEnvs/firetail/lib/python3.7/site-packages/django/contrib/messages/storage/base.py" in add
140. if level < self.level:
Exception Type: TypeError at /controle/enterprise/branch/7/change/
Exception Value: '<' not supported between instances of 'int' and 'str'
Это файл настроек / common.py:
import os
from django.conf import settings
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), os.path.pardir)
# Default
ABSOLUTE_URL_OVERRIDES = {}
# Default
ADMINS = ()
# Default
ALLOWED_HOSTS = [
]
# Default
APPEND_SLASH = True
# Default
CACHES = {
'default': {
#'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
}
}
# Default
DATABASES = {
'default': {
'HOST': 'localhost',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'firetail',
'USER': 'firetail',
'PASSWORD': 'XXXXXXXXXXXXXXXXXXX',
},
'default_': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, 'database.db'),
},
'backup': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(PROJECT_ROOT, 'database-backup.db'),
}
}
# Default
DATABASE_ROUTERS = []
# Default
DATE_FORMAT = 'N j, Y'
# Default
DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
)
# Default
DATETIME_FORMAT = 'N j, Y, P'
# Default
DATETIME_INPUT_FORMATS = (
'%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
'%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200'
'%Y-%m-%d %H:%M', # '2006-10-25 14:30'
'%Y-%m-%d', # '2006-10-25'
'%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
'%m/%d/%Y %H:%M:%S.%f', # '10/25/2006 14:30:59.000200'
'%m/%d/%Y %H:%M', # '10/25/2006 14:30'
'%m/%d/%Y', # '10/25/2006'
'%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
'%m/%d/%y %H:%M:%S.%f', # '10/25/06 14:30:59.000200'
'%m/%d/%y %H:%M', # '10/25/06 14:30'
'%m/%d/%y', # '10/25/06'
)
# Default
DEBUG = False
# Default
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = '.'
# Default
DEFAULT_CHARSET = 'utf-8'
# Default
DEFAULT_CONTENT_TYPE = 'text/html'
# Default
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
# Default
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
# Default
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
# Default
DEFAULT_INDEX_TABLESPACE = ''
# Default
DEFAULT_TABLESPACE = ''
# Default
DISALLOWED_USER_AGENTS = ()
# Default
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
# Default
EMAIL_FILE_PATH = 'localhost'
# Default
EMAIL_HOST = 'localhost'
# Default
EMAIL_HOST_PASSWORD = ''
# Default
EMAIL_HOST_USER = ''
# Default
EMAIL_PORT = 25
# Default
EMAIL_SUBJECT_PREFIX = '[Django]'
# Default
EMAIL_USE_TLS = False
# Default
EMAIL_USE_SSL = False
# Default
FILE_CHARSET = 'utf-8'
# Default
FILE_UPLOAD_HANDLERS = (
"django.core.files.uploadhandler.MemoryFileUploadHandler",
"django.core.files.uploadhandler.TemporaryFileUploadHandler",
)
# Default
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
# Default
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
# Default
FILE_UPLOAD_PERMISSIONS = None
# Default
FILE_UPLOAD_TEMP_DIR = None
# Default
FIRST_DAY_OF_WEEK = 0
# Default
FIXTURE_DIRS = ()
# Default
FORCE_SCRIPT_NAME = None
# Default
FORMAT_MODULE_PATH = None
# Default
IGNORABLE_404_URLS = ()
# Default
INTERNAL_IPS = ()
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'rest_framework',
'applications.frontend',
'applications.backend',
'applications.inventory',
'applications.retail',
'applications.workforce',
'applications.enterprise',
'applications.costumer',
'applications.delivery',
'bootstrap3',
)
LANGUAGE_CODE = 'pt-BR'
# Default
LANGUAGE_COOKIE_AGE = None
# Default
LANGUAGE_COOKIE_DOMAIN = None
# Default
LANGUAGE_COOKIE_NAME = 'django_language'
# Default
LANGUAGE_COOKIE_PATH = '/'
# LANGUAGES
# Default
LOCALE_PATHS = ()
# LOGGING
# LOGGING_CONFIG
MANAGERS = ADMINS
# Default
MEDIA_ROOT = ''
# Default
MEDIA_URL = ''
MIDDLEWARE = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
# Default
MIGRATION_MODULES = {}
# Default
MONTH_DAY_FORMAT = 'F j'
NUMBER_GROUPING = 3
# Default
PREPEND_WWW = False
ROOT_URLCONF = 'urls'
# Default
SECRET_KEY = ''
# Default
SECURE_PROXY_SSL_HEADER = None
#SERIALIZATION_MODULES
# Default
SERVER_EMAIL = 'root@localhost'
# Default
SHORT_DATE_FORMAT = 'm/d/Y'
# Default
SHORT_DATETIME_FORMAT = 'm/d/Y P'
# Default
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
# Default
SILENCED_SYSTEM_CHECKS = []
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(PROJECT_ROOT,'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'debug': DEBUG,
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
'applications.enterprise.context.open_operation',
'applications.enterprise.context.enterprise',
],
},
},
]
# Default
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
# Default
TEST_NON_SERIALIZED_APPS = []
THOUSAND_SEPARATOR = '.'
USE_THOUSAND_SEPARATOR = False
# Default
TIME_FORMAT = 'P'
# Default
TIME_INPUT_FORMATS = (
'%H:%M:%S', # '14:30:59'
'%H:%M:%S.%f', # '14:30:59.000200'
'%H:%M', # '14:30'
)
TIME_ZONE = 'America/Sao_Paulo'
# Default
USE_ETAGS = False
# Default
USE_I18N = False
USE_L10N = False
USE_TZ = True
# Default
USE_X_FORWARDED_HOST = False
#WSGI_APPLICATION = 'mytestsite.wsgi.application'
# Default
YEAR_MONTH_FORMAT = 'F Y'
# Default
X_FRAME_OPTIONS = 'SAMEORIGIN'
# --------- Auth Settings -------------------
# Default
AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend',)
# Default
AUTH_USER_MODEL = 'auth.User'
LOGIN_REDIRECT_URL = '/painel'
LOGIN_URL = '/entrar'
LOGOUT_URL = '/sair'
# Default
PASSWORD_RESET_TIMEOUT_DAYS = 3
# Default
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
'django.contrib.auth.hashers.CryptPasswordHasher')
# ------------ Comments Settings ----------
# Default
COMMENTS_HIDE_REMOVE = True
# Default
COMMENT_MAX_LENGTH = 3000
#COMMENTS_APP
# Default
PROFANITIES_LIST = ()
# --------------- Message Settings ----------------
# Default
MESSAGE_LEVEL = 'messages.INFO'
# Default
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
# Default
MESSAGE_TAGS = {
'messages.DEBUG': 'debug',
'messages.INFO': 'info',
'messages.SUCCESS': 'success',
'messages.WARNING': 'warning',
'messages.ERROR': 'error'
}
# --------------- Sessions Settings ----------------
# Default
#SESSION_CACHE_ALIAS
# Default
SESSION_COOKIE_AGE = 1209600
# Default
SESSION_COOKIE_DOMAIN = None
# Default
SESSION_COOKIE_HTTPONLY = True
# Default
SESSION_COOKIE_NAME = 'sessionid'
# Default
SESSION_COOKIE_PATH = '/'
# Default
SESSION_COOKIE_SECURE = False
# Default
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
# Default
SESSION_FILE_PATH = None
# Default
SESSION_SAVE_EVERY_REQUEST = False
# Default
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
# --------------- Sites Settings ----------------
SITE_ID = 1
# --------------- Static Files Settings ----------------
STATIC_ROOT = ''
STATIC_URL = '/static/'
#STATICFILES_DIRS = [os.path.join(PROJECT_ROOT, os.path.pardir,os.path.pardir,'static')]
#STATICFILES_STORAGE
#STATICFILES_FINDERS
REST_FRAMEWORK = {
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [
# 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
]
}
Это мои настройки / devel.py
from settings.common import *
INSTALLED_APPS = INSTALLED_APPS + (
'django_extensions',
)
DEBUG = True
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
SECRET_KEY = 'XXXXXX'