Group in default reader fixtures does not exist
Closed this issue · 2 comments
Elementrio commented
After running init.py I get an error stating "Group matching query does not exist."
Logs
Migrations for 'reader':
reader/migrations/0001_initial.py
- Create model Group
- Create model Person
- Create model Series
- Create model HitCount
- Create model Volume
- Create model ChapterIndex
- Create model Chapter
Traceback (most recent call last):
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 173, in __get__
rel_obj = self.field.get_cached_value(instance)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/db/models/fields/mixins.py", line 15, in get_cached_value
return instance._state.fields_cache[cache_name]
KeyError: 'group'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/serializers/json.py", line 70, in Deserializer
yield from PythonDeserializer(objects, **options)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/serializers/python.py", line 146, in Deserializer
obj = base.build_instance(Model, data, using)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/serializers/base.py", line 270, in build_instance
return Model(**data)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/db/models/base.py", line 503, in __init__
post_init.send(sender=cls, instance=self)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 177, in send
return [
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/dispatch/dispatcher.py", line 178, in <listcomp>
(receiver, receiver(signal=self, sender=sender, **named))
File "/home/kay/dev/python/guyamoe/app/reader/signals.py", line 85, in remember_original_series_of_chapter
instance.old_group_id = str(instance.group.id) if hasattr(instance, 'group') else None
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 187, in __get__
rel_obj = self.get_object(instance)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 154, in get_object
return qs.get(self.field.get_reverse_related_filter(instance))
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/db/models/query.py", line 429, in get
raise self.model.DoesNotExist(
reader.models.DoesNotExist: Group matching query does not exist.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/management/commands/loaddata.py", line 114, in loaddata
self.load_label(fixture_label)
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/management/commands/loaddata.py", line 172, in load_label
for obj in objects:
File "/home/kay/dev/python/guyamoe/lib/python3.8/site-packages/django/core/serializers/json.py", line 74, in Deserializer
raise DeserializationError() from exc
django.core.serializers.base.DeserializationError: Problem installing fixture '/home/kay/dev/python/guyamoe/app/./reader/fixtures/reader_fixtures.json':
appu1232 commented
Hm I believe this is causing issues due to the pre/post save Django signals getting triggered as these objects get saved to the database from the fixture. This is a bit of a hacky solution for setup but you could just comment out everything in reader/signals.py
(and misc/signals.py
too if that causes issues) and give it a go again.
Elementrio commented
That did in fact fix it.