Closed jrief closed 1 day ago
I fear versioning might interfere with the proper update of the languages
field. The information is clearly redundant and was a performance compromise in v3. Have you checked if list(page_obj.page_content_cache.keys())
would work for you? If so, we consider should
languages
field by a @property
get_languages
by the above expressionAs long as you are at least accessing one language, this does not create additional database queries.
Something like this for the Page
model - the languages
field would be removed then:
def get_languages(self):
self._get_page_content_cache(None, False, False)
return list(self.page_content_cache.keys())
@property
def languages(self):
return ",".join(self.get_languages())
if this doesn't hurt performance, it certainly would be a better solution.
What about using @cached_property
?
Description
I currently have no receipt to reproduce this, but apparently we have an inconsistency in our database regarding the field
languages
in modelPage
.Steps to reproduce
This currently is not reproducible, but I can explain what is happening using the Django shell:
Expected behaviour
Since the German and English page content objects are published, I would expect that
page.languages == 'de,en'
Actual behaviour
page.languages == 'de'
Additional information (CMS/Python/Django versions)
Django-CMS-4.1.1
Do you want to help fix this issue?
Since this field is non-normalized, at least there should be a management command to fix it in case of data corruption.