Progetto

Generale

Profilo

Segnalazione #766

Non si eliminano gli studenti

Aggiunto da Piergiorgio Cemin 4 mesi fa.

Stato:
Nuovo
Priorità:
Normale
Assegnato a:
Versione prevista:
-
Inizio:
02-03-2019
Scadenza:
% completato:

0%

Resolution:

Descrizione

Eliminando studenti si ha il seguente errore:

IntegrityError at /admin/sportday/student/

(1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`sportday`.`sportday_partecipation`, CONSTRAINT `sportday_partecipati_student_id_495fe2f3_fk_sportday_` FOREIGN KEY (`student_id`) REFERENCES `sportday_student` (`id`))')

Request Method: POST
Request URL: https://sportday.fuss.bz.it/admin/sportday/student/?q=Liceo
Django Version: 2.0
Exception Type: IntegrityError
Exception Value:

(1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`sportday`.`sportday_partecipation`, CONSTRAINT `sportday_partecipati_student_id_495fe2f3_fk_sportday_` FOREIGN KEY (`student_id`) REFERENCES `sportday_student` (`id`))')

Exception Location: /var/www/dj2/lib/python3.5/site-packages/MySQLdb/connections.py in query, line 277
Python Executable: /usr/bin/python3
Python Version: 3.5.3
Python Path:

['/var/www/sportday',
'/var/www/dj2/lib/python35.zip',
'/var/www/dj2/lib/python3.5',
'/var/www/dj2/lib/python3.5/plat-x86_64-linux-gnu',
'/var/www/dj2/lib/python3.5/lib-dynload',
'/usr/lib/python3.5',
'/usr/lib/python3.5/plat-x86_64-linux-gnu',
'/var/www/dj2/lib/python3.5/site-packages']

Server time: Sab, 2 Mar 2019 08:39:23 +0100

Environment:

Request Method: POST
Request URL: https://sportday.fuss.bz.it/admin/sportday/student/?q=Liceo

Django Version: 2.0
Python Version: 3.5.3
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'djsport',
'sportday']
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',
'django.middleware.locale.LocaleMiddleware']

Traceback:

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/mysql/base.py" in execute
71. return self.cursor.execute(query, args)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in execute
250. self.errorhandler(self, exc, value)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/connections.py" in defaulterrorhandler
50. raise errorvalue

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in execute
247. res = self._query(query)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in _query
411. rowcount = self._do_query(q)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in _do_query
374. db.query(q)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/connections.py" in query
277. _mysql.connection.query(self, query)

The above exception ((1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`sportday`.`sportday_partecipation`, CONSTRAINT `sportday_partecipati_student_id_495fe2f3_fk_sportday_` FOREIGN KEY (`student_id`) REFERENCES `sportday_student` (`id`))')) was the direct cause of the following exception:

File "/var/www/dj2/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
35. response = get_response(request)

File "/var/www/dj2/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
128. response = self.process_exception_by_middleware(e, request)

File "/var/www/dj2/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
126. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/var/www/dj2/lib/python3.5/site-packages/django/contrib/admin/options.py" in wrapper
574. return self.admin_site.admin_view(view)(*args, **kwargs)

File "/var/www/dj2/lib/python3.5/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)

File "/var/www/dj2/lib/python3.5/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)

File "/var/www/dj2/lib/python3.5/site-packages/django/contrib/admin/sites.py" in inner
223. return view(request, *args, **kwargs)

File "/var/www/dj2/lib/python3.5/site-packages/django/utils/decorators.py" in _wrapper
62. return bound_func(*args, **kwargs)

File "/var/www/dj2/lib/python3.5/site-packages/django/utils/decorators.py" in _wrapped_view
142. response = view_func(request, *args, **kwargs)

File "/var/www/dj2/lib/python3.5/site-packages/django/utils/decorators.py" in bound_func
58. return func.__get__(self, type(self))(*args2, **kwargs2)

File "/var/www/dj2/lib/python3.5/site-packages/django/contrib/admin/options.py" in changelist_view
1612. response = self.response_action(request, queryset=cl.get_queryset(request))

File "/var/www/dj2/lib/python3.5/site-packages/django/contrib/admin/options.py" in response_action
1330. response = func(self, request, queryset)

File "/var/www/dj2/lib/python3.5/site-packages/django/contrib/admin/actions.py" in delete_selected
48. queryset.delete()

File "/var/www/dj2/lib/python3.5/site-packages/django/db/models/query.py" in delete
662. deleted, _rows_count = collector.delete()

File "/var/www/dj2/lib/python3.5/site-packages/django/db/models/deletion.py" in delete
283. count = qs._raw_delete(using=self.using)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/models/query.py" in _raw_delete
676. return sql.DeleteQuery(self.model).delete_qs(self, using)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/models/sql/subqueries.py" in delete_qs
66. return self.delete_batch(values, using)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/models/sql/subqueries.py" in delete_batch
41. num_deleted += self.do_query(self.get_meta().db_table, self.where, using=using)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/models/sql/subqueries.py" in do_query
24. cursor = self.get_compiler(using).execute_sql(CURSOR)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
1063. cursor.execute(sql, params)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
100. return super().execute(sql, params)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
68. return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute_with_wrappers
77. return executor(sql, params, many, context)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/utils.py" in exit
89. raise dj_exc_value.with_traceback(traceback) from exc_value

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/utils.py" in _execute
85. return self.cursor.execute(sql, params)

File "/var/www/dj2/lib/python3.5/site-packages/django/db/backends/mysql/base.py" in execute
71. return self.cursor.execute(query, args)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in execute
250. self.errorhandler(self, exc, value)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/connections.py" in defaulterrorhandler
50. raise errorvalue

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in execute
247. res = self._query(query)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in _query
411. rowcount = self._do_query(q)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/cursors.py" in _do_query
374. db.query(q)

File "/var/www/dj2/lib/python3.5/site-packages/MySQLdb/connections.py" in query
277. _mysql.connection.query(self, query)

Exception Type: IntegrityError at /admin/sportday/student/
Exception Value: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`sportday`.`sportday_partecipation`, CONSTRAINT `sportday_partecipati_student_id_495fe2f3_fk_sportday_` FOREIGN KEY (`student_id`) REFERENCES `sportday_student` (`id`))')

Esporta su Atom PDF