ponder-lab / Imperative-DL-Study-Web-App

0 stars 0 forks source link

Can't categorize using user ID 11 #64

Closed khatchad closed 3 years ago

khatchad commented 3 years ago

I tried to add a categorization for 05b6a643d1aa82be3acf8324181595d8abff1eb1 (I am on b910532c), but I received an exception. I just entered is func fix = false without any other data to the form.

Environment:

Request Method: POST
Request URL: https://fathomless-inlet-57767.herokuapp.com/ponder/categorizations/add%3Fcommit%3D05b6a643d1aa82be3acf8324181595d8abff1eb1

Django Version: 3.1.7
Python Version: 3.7.8
Installed Applications:
['ponder.apps.BugFixesConfig',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_tables2',
 'debug_toolbar',
 'crispy_forms',
 'django_filters',
 'bootstrap3']
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',
 'debug_toolbar.middleware.DebugToolbarMiddleware']

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/app/.heroku/python/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/app/.heroku/python/lib/python3.7/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/app/.heroku/python/lib/python3.7/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)

The above exception ((1452, 'Cannot add or update a child row: a foreign key constraint fails (`heroku_4ac11fb2946b4e7`.`categorizations`, CONSTRAINT `categorizations_ibfk_8` FOREIGN KEY (`categorizer`) REFERENCES `categorizers` (`id`))')) was the direct cause of the following exception:
  File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/app/ponder/views.py", line 184, in categorizations
    categorization.save()
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 754, in save
    force_update=force_update, update_fields=update_fields)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 792, in save_base
    force_update, using, update_fields,
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 895, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/base.py", line 935, in _do_insert
    using=using, raw=raw,
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/query.py", line 1254, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
    cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/app/.heroku/python/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/app/.heroku/python/lib/python3.7/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/app/.heroku/python/lib/python3.7/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)

Exception Type: IntegrityError at /ponder/categorizations/add?commit=05b6a643d1aa82be3acf8324181595d8abff1eb1
Exception Value: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`heroku_4ac11fb2946b4e7`.`categorizations`, CONSTRAINT `categorizations_ibfk_8` FOREIGN KEY (`categorizer`) REFERENCES `categorizers` (`id`))')
khatchad commented 3 years ago

Looks like the categorizer isn't being looked up correctly, at least for my user, whose ID is 11.

khatchad commented 3 years ago

This is probably a regression.

khatchad commented 3 years ago

Cannot repro on 0c4ef02b.