django-orchestra/orchestra/core/translations.py

14 lines
400 B
Python
Raw Permalink Normal View History

2023-07-09 07:51:51 +00:00
class ModelTranslation(object):
"""
Collects all model fields that would be translated
using 'makemessages --domain database' management command
"""
_registry = {}
@classmethod
def register(cls, model, fields):
if model in cls._registry:
raise ValueError("Model %s already registered." % model.__name__)
cls._registry[model] = fields