48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
"""
|
|
Django Translatable Fields
|
|
|
|
A Django plugin that mimics Odoo's translate=True functionality,
|
|
providing language-aware field handling in the admin interface.
|
|
|
|
This package is optimized for PostgreSQL and provides the best performance
|
|
when used with PostgreSQL databases. While it supports MySQL and SQLite,
|
|
PostgreSQL is strongly recommended for production use.
|
|
|
|
Requirements:
|
|
- Django 4.2+
|
|
- PostgreSQL 12+ (recommended)
|
|
- psycopg2-binary 2.9.0+
|
|
|
|
Author: Holger Sielaff <holger@backender.de>
|
|
"""
|
|
|
|
__version__ = '0.1.0'
|
|
|
|
default_app_config = 'django_translatable_fields.apps.TranslatableFieldsConfig'
|
|
|
|
# Import main fields for easy access
|
|
from .fields import (
|
|
CharField, TextField, EmailField, URLField, SlugField,
|
|
)
|
|
|
|
# Import DRF serializer components (optional import)
|
|
try:
|
|
from .serializers import (
|
|
TranslatableSerializerMixin, TranslatableField,
|
|
TranslatableCharField, TranslatableTextField,
|
|
TranslatableEmailField, TranslatableURLField, TranslatableSlugField
|
|
)
|
|
_HAS_DRF = True
|
|
except ImportError:
|
|
_HAS_DRF = False
|
|
|
|
__all__ = [
|
|
'CharField', 'TextField', 'EmailField', 'URLField', 'SlugField',
|
|
]
|
|
|
|
if _HAS_DRF:
|
|
__all__.extend([
|
|
'TranslatableSerializerMixin', 'TranslatableField',
|
|
'TranslatableCharField', 'TranslatableTextField',
|
|
'TranslatableEmailField', 'TranslatableURLField', 'TranslatableSlugField'
|
|
]) |