Tabbed UI for django-modeltrans
Project description
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",
),
),
}
)
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_modeltrans_tabs-0.1.1.tar.gz.
File metadata
- Download URL: django_modeltrans_tabs-0.1.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.5 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f660c4bb39258d364fa90ce4d4eb29d85c24635256ee266e20c2e039c0fe744
|
|
| MD5 |
9f86fe4bbd31e6009daa45c61a08cd7f
|
|
| BLAKE2b-256 |
aedd0cb11456fdccf20ff1589f36741a96c054a93b39fdf1288ce70175cfb970
|
File details
Details for the file django_modeltrans_tabs-0.1.1-py3-none-any.whl.
File metadata
- Download URL: django_modeltrans_tabs-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.5 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
419a61260881e534827e2294f5aaf9545189ae2d61c4605b3cc5f20a39d53215
|
|
| MD5 |
f662d66854ba290a217b9b12347d17e1
|
|
| BLAKE2b-256 |
8bd1a11d8b4b242eebd36d9a3afdfb64bccf20f7b718e9a3be5a434adf8e0d1a
|