django-modeltrans-tabs
Adds a tabbed UI to django-modeltrans translation fields in the Django Admin.
Installation
Use your preferred package manager:
pip install django-modeltrans-tabs
Setup
Just two steps to enable. First, update your settings.py:
INSTALLED_APPS = [
# Ensure staticfiles is installed
"django.contrib.staticfiles",
#
# Add modeltrans-tabs:
"modeltrans_tabs",
]
Then, inherit the mixin from your ModelAdmin:
from modeltrans_tabs.admin import TabbedLanguageMixin
class MyModelAdmin(TabbedLanguageMixin, admin.ModelAdmin):
...
Usage
By default, the admin mixin will modify your fieldset to incorporate your translated fields. No changes are required in this case.
If you use a customized fieldset on your ModelAdmin, you will need to update the field list to include all languages for a translated field as a tuple.
This uses the Admin's feature to show multiple fields in the same row. Note that you do not include the field_i18n variant.
Using the i18n_fields helper method:
class MyModelAdmin(TabbedLanguageMixin, admin.ModelAdmin):
def get_fieldsets(self, request, obj=None):
return (
(
None,
{
"fields": (
"normal_field",
self.i18n_field("translated_field"),
),
}
)
)
Or manually:
class MyModelAdmin(TabbedLanguageMixin, admin.ModelAdmin):
fieldsets = (
(
None,
{
"fields": (
"normal_field",
(
"translated_field",
"translated_field_de",
"translated_field_fr",
"translated_field_it",
),
),
}
)
)
Release files for django-modeltrans-tabs 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_modeltrans_tabs-0.1.1.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_modeltrans_tabs-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / django_modeltrans_tabs-0.1.1.tar.gz
| Download URL | django_modeltrans_tabs-0.1.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f660c4bb39258d364fa90ce4d4eb29d85c24635256ee266e20c2e039c0fe744
|
|
BLAKE2b-256 checksum How to use checksums |
aedd0cb11456fdccf20ff1589f36741a96c054a93b39fdf1288ce70175cfb970
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.5 Linux/5.15.153.1-microsoft-standard-WSL2
|
Release files / django_modeltrans_tabs-0.1.1-py3-none-any.whl
| Download URL | django_modeltrans_tabs-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
419a61260881e534827e2294f5aaf9545189ae2d61c4605b3cc5f20a39d53215
|
|
BLAKE2b-256 checksum How to use checksums |
8bd1a11d8b4b242eebd36d9a3afdfb64bccf20f7b718e9a3be5a434adf8e0d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.5 Linux/5.15.153.1-microsoft-standard-WSL2
|