When I try to delete a location through the django admin, there is a warning that lots of related items will be deleted. When I click to continue, I get the following error:
Traceback (most recent call last):
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/core/servers/basehttp.py", line 651, in __call__
return self.application(environ, start_response)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/core/handlers/base.py", line 133, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/core/handlers/base.py", line 153, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/core/handlers/base.py", line 91, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/contrib/admin/sites.py", line 158, in root
return self.model_page(request, *url.split('/', 2))
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/contrib/admin/sites.py", line 177, in model_page
return admin_obj(request, rest_of_url)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/contrib/admin/options.py", line 195, in __call__
return self.delete_view(request, unquote(url[:-7]))
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/contrib/admin/options.py", line 709, in delete_view
obj.delete()
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/db/models/base.py", line 476, in delete
delete_objects(seen_objs)
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/db/models/query.py", line 912, in delete_objects
transaction.commit_unless_managed()
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/db/transaction.py", line 147, in commit_unless_managed
connection._commit()
File "/mnt/hgfs/sftp/keg/dev/site/lib/django/db/backends/__init__.py", line 28, in _commit
return self.connection.commit()
IntegrityError: update or delete on table "locations_location" violates foreign key constraint "location_id_refs_id_3c5d8d6525a8e11e" on table "newsletters_newsletterssubscription"
DETAIL: Key (id)=(98) is still referenced from table "newsletters_newsletterssubscription".
the newsletterssubscription model has a 'location' field with location as the foreign key, but I went through and changed the foreign key of all fields who refer to the location in question to None
. I still get this error. I have no idea what DETAIL: Key (id)=(98)
is referring to. Any help would be appreciated.