Files
old-saburly-wagtail-web/env/lib/python3.10/site-packages/wagtail/locales/utils.py
2024-08-27 20:33:44 +02:00

19 lines
462 B
Python

from wagtail.models import Page, get_translatable_models
def get_locale_usage(locale):
"""
Returns the number of pages and other objects that use a locale
"""
num_pages = Page.objects.filter(locale=locale).exclude(depth=1).count()
num_others = 0
for model in get_translatable_models():
if model is Page:
continue
num_others += model.objects.filter(locale=locale).count()
return num_pages, num_others