graph LR
TranslationAdmin["TranslationAdmin"]
TranslationForm["TranslationForm"]
TranslationWidget["TranslationWidget"]
TranslationAdmin -- "uses" --> TranslationForm
TranslationAdmin -- "uses" --> TranslationWidget
TranslationForm -- "processes data from" --> TranslationWidget
The Admin & Form Interface subsystem encompasses the modules modeltranslation.admin, modeltranslation.forms, and modeltranslation.widgets. These modules collectively extend Django's administrative interface and form handling mechanisms to provide a seamless and user-friendly way to manage translated content within a Django application.
This component (modeltranslation.admin.TranslationAdmin) is the core extension point for Django's administrative interface. It customizes the display and behavior of model change forms to accommodate translated fields. Its primary responsibility is to orchestrate how translated fields are presented, allowing administrators to manage content in multiple languages. It dynamically modifies fieldsets, form fields, and integrates specialized widgets to achieve this.
Related Classes/Methods:
The TranslationForm component (modeltranslation.forms.TranslationForm) serves as the foundational form class for handling translation-aware field processing. It extends Django's ModelForm to incorporate logic specific to translated fields, such as determining if a translated field's value has changed across different languages. It ensures that form submissions correctly process and save multilingual content.
Related Classes/Methods:
This component (modeltranslation.widgets.TranslationWidget) provides the user interface elements for inputting and displaying translated content within forms. It is responsible for rendering the appropriate HTML for translated fields, often including multiple input fields for different languages, and for processing their values from submitted form data. It can also manage any necessary media assets (like JavaScript or CSS) required for its functionality.
Related Classes/Methods: