integreat-cms
integreat-cms copied to clipboard
`ValueError` when creating a brand new page
Describe the Bug
When an user tries to create a new page and opens the page form, ValueError
occurs in background, although it looks working perfect in the user interface.
Steps to Reproduce
- Go to "Create page"
- See
ValueError
in the console
Expected Behavior
No error
Actual Behavior
ValueError
Additional Information
Traceback
Traceback (most recent call last): File "/home/micucu/integreat-cms/integreat_cms/cms/models/abstract_base_model.py", line 46, in __repr__
return self.get_repr()
^^^^^^^^^^^^^^^
File "/home/micucu/integreat-cms/integreat_cms/cms/models/pages/page.py", line 377, in get_repr
f", slug: {self.best_translation.slug}" if self.best_translation else ""
^^^^^^^^^^^^^^^^^^^^^
File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
^^^^^^^^^^^^^^^^^^^
File "/home/micucu/integreat-cms/integreat_cms/cms/models/abstract_content_model.py", line 437, in best_translation
or self.translations.first()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/home/micucu/integreat-cms/.venv/lib/python3.11/site-packages/django/db/models/fields/related_descriptors.py", line 718, in get_queryset
raise ValueError(
ValueError: 'Page' instance needs to have a primary key value before this relationship can be used.