Medien existieren doppelt in der Datenbank (mit gleichem Namen)
Manche Medien existieren zweimal und können daher nicht via Name eindeutig abgerufen werden.
-
finden, warum/wo das Medium erneut reingeschrieben wird
No changes detected
Operations to perform:
Apply all migrations: admin, articles, auth, contenttypes, cropping, db, pr_upload, prediction, sessions
Running migrations:
No migrations to apply.
Traceback (most recent call last):
File "/app/manage.py", line 22, in <module>
main()
File "/app/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/app/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/app/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute
output = self.handle(*args, **options)
File "/app/lib/python3.9/site-packages/django/core/management/base.py", line 96, in wrapped
res = handle_func(*args, **kwargs)
File "/app/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 376, in handle
emit_post_migrate_signal(
File "/app/lib/python3.9/site-packages/django/core/management/sql.py", line 52, in emit_post_migrate_signal
models.signals.post_migrate.send(
File "/app/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 176, in send
return [
File "/app/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/app/articles/post_migrations.py", line 85, in assign_media_regionality
MediumSerializer().create({'name': key, 'medium_type': enum.value, 'medium_type_description': enum.value})
File "/app/articles/serializers.py", line 51, in create
medium, created = Medium.objects.update_or_create(name=validated_data.get('name', None),
File "/app/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/lib/python3.9/site-packages/django/db/models/query.py", line 961, in update_or_create
obj, created = self.select_for_update().get_or_create(defaults, **kwargs)
File "/app/lib/python3.9/site-packages/django/db/models/query.py", line 928, in get_or_create
return self.get(**kwargs), False
File "/app/lib/python3.9/site-packages/django/db/models/query.py", line 653, in get
raise self.model.MultipleObjectsReturned(
articles.models.Medium.MultipleObjectsReturned: get() returned more than one Medium -- it returned 2!
2022-08-29 12:57:19,907 - INFO django.utils.autoreload.autoreload Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 29, 2022 - 12:57:21
Django version 4.1, using settings 'one_api.settings_prod'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Edited by Lewin Kästner