Answer the question
In order to leave comments, you need to log in
Error value too long for type character varying(300), crashes for no apparent reason?
I connected the postgres database to the project, carried out all the migrations, they were applied, there is no limit of 300 characters anywhere in the models, but this error crashes. Moreover, everything is saved in the database, after an error occurs, I reload the page and the value is saved, there are no errors in the database itself when adding directly, there are no restrictions on 300 characters either. If it's not the database, then what is it? Maybe I did the migration wrong? But they applied correctly, I deleted them, deleted the database, recreated the database, changed the encodings, but everything was in vain, the migrations are applied, but the error continues to crash. Could this be an ORM issue? Please let me know where is the problem and what am I doing wrong.
Traceback:
Environment:
Request Method: POST
Request URL: http://192.168.10.222:8080/base/edit_project/1099/
Django Version: 2.2
Python Version: 3.8.7
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'templatesApp',
'changelog',
'accounts',
'dashboard',
'reference',
'baseTables',
'adminTables',
'reports']
Installed 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']
Traceback:
File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py" in _execute
84. return self.cursor.execute(sql, params)
The above exception (value too long for type character varying(300)
) was the direct cause of the following exception:
File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)
File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py" in _get_response
115. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.8/dist-packages/django/core/handlers/base.py" in _get_response
113. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.8/dist-packages/django/contrib/auth/decorators.py" in _wrapped_view
21. return view_func(request, *args, **kwargs)
File "/home/itpw/project/nik/vkmtsup_django2/vkmt_sup/baseTables/views.py" in EditProjectView
613. obj.save()
File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py" in save
740. self.save_base(using=using, force_insert=force_insert,
File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py" in save_base
788. post_save.send(
File "/usr/local/lib/python3.8/dist-packages/django/dispatch/dispatcher.py" in send
173. return [
File "/usr/local/lib/python3.8/dist-packages/django/dispatch/dispatcher.py" in <listcomp>
174. (receiver, receiver(signal=self, sender=sender, **named))
File "/home/itpw/project/nik/vkmtsup_django2/vkmt_sup/changelog/signals.py" in journal_save_handler
19. ChangeLog.add(instance, loggedIn.current_user, loggedIn.address, ACTION_UPDATE, (instance._meta.get_field(change).verbose_name.title()+': '+str(changed[change]['old'])+' --> ' +str(changed[change]['new'])), id=last_saved['id'])
File "/home/itpw/project/nik/vkmtsup_django2/vkmt_sup/changelog/models.py" in add
47. log.save()
File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py" in save
740. self.save_base(using=using, force_insert=force_insert,
File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py" in save_base
777. updated = self._save_table(
File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py" in _save_table
870. result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/usr/local/lib/python3.8/dist-packages/django/db/models/base.py" in _do_insert
907. return manager._insert([self], fields=fields, return_id=update_pk,
File "/usr/local/lib/python3.8/dist-packages/django/db/models/manager.py" in manager_method
82. return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/django/db/models/query.py" in _insert
1186. return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python3.8/dist-packages/django/db/models/sql/compiler.py" in execute_sql
1332. cursor.execute(sql, params)
File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py" in execute
99. return super().execute(sql, params)
File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py" in execute
67. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py" in _execute_with_wrappers
76. return executor(sql, params, many, context)
File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py" in _execute
84. return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.8/dist-packages/django/db/utils.py" in __exit__
89. raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/dist-packages/django/db/backends/utils.py" in _execute
84. return self.cursor.execute(sql, params)
Exception Type: DataError at /base/edit_project/1099/
Exception Value: value too long for type character varying(300)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question