Override admin path in cli with env param
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,3 +7,6 @@ venv
|
||||
!CHANGELOG.md
|
||||
!README.md
|
||||
/*.md
|
||||
/venv*
|
||||
/dist
|
||||
/django_translatable_fields/dist/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Metadata-Version: 2.1
|
||||
Metadata-Version: 2.4
|
||||
Name: django-translatable-fields
|
||||
Version: 0.1.0
|
||||
Summary: Django plugin that mimics Odoo's translate=True functionality with admin interface integration
|
||||
@@ -52,9 +52,19 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Python: >=3.9
|
||||
Description-Content-Type: text/markdown
|
||||
Provides-Extra: dev
|
||||
Provides-Extra: drf
|
||||
License-File: LICENSE
|
||||
Requires-Dist: Django>=4.2
|
||||
Provides-Extra: dev
|
||||
Requires-Dist: pytest; extra == "dev"
|
||||
Requires-Dist: pytest-django; extra == "dev"
|
||||
Requires-Dist: black; extra == "dev"
|
||||
Requires-Dist: isort; extra == "dev"
|
||||
Requires-Dist: flake8; extra == "dev"
|
||||
Requires-Dist: mypy; extra == "dev"
|
||||
Requires-Dist: django-stubs; extra == "dev"
|
||||
Provides-Extra: drf
|
||||
Requires-Dist: djangorestframework>=3.14.0; extra == "drf"
|
||||
Dynamic: license-file
|
||||
|
||||
# Django Translatable Fields
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
Django>=4.2
|
||||
|
||||
[dev]
|
||||
black
|
||||
django-stubs
|
||||
flake8
|
||||
isort
|
||||
mypy
|
||||
pytest
|
||||
pytest-django
|
||||
black
|
||||
isort
|
||||
flake8
|
||||
mypy
|
||||
django-stubs
|
||||
|
||||
[drf]
|
||||
djangorestframework>=3.14.0
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
Metadata-Version: 2.4
|
||||
Name: django-translatable-fields
|
||||
Version: 0.1.0
|
||||
Summary: Django fields with Odoo-style translate=True functionality
|
||||
Home-page: https://github.com/holger/django-translatable-fields
|
||||
Author: Holger Sielaff
|
||||
Author-email: holger@backender.de
|
||||
Keywords: django,translation,i18n,l10n,fields,postgresql,json,odoo
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Django
|
||||
Classifier: Framework :: Django :: 4.2
|
||||
Classifier: Framework :: Django :: 5.0
|
||||
Classifier: Framework :: Django :: 5.1
|
||||
Classifier: Framework :: Django :: 5.2
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: 3.10
|
||||
Classifier: Programming Language :: Python :: 3.11
|
||||
Classifier: Programming Language :: Python :: 3.12
|
||||
Classifier: Topic :: Internet :: WWW/HTTP
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Topic :: Database
|
||||
Classifier: Topic :: Text Processing :: Linguistic
|
||||
Requires-Python: >=3.8
|
||||
Description-Content-Type: text/markdown
|
||||
Requires-Dist: Django<6.0,>=4.2
|
||||
Requires-Dist: psycopg2-binary>=2.9.0
|
||||
Provides-Extra: dev
|
||||
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
||||
Requires-Dist: pytest-django>=4.5.0; extra == "dev"
|
||||
Requires-Dist: black>=22.0.0; extra == "dev"
|
||||
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
||||
Requires-Dist: mypy>=0.991; extra == "dev"
|
||||
Provides-Extra: postgres
|
||||
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
|
||||
Dynamic: author
|
||||
Dynamic: author-email
|
||||
Dynamic: classifier
|
||||
Dynamic: description
|
||||
Dynamic: description-content-type
|
||||
Dynamic: home-page
|
||||
Dynamic: keywords
|
||||
Dynamic: provides-extra
|
||||
Dynamic: requires-dist
|
||||
Dynamic: requires-python
|
||||
Dynamic: summary
|
||||
|
||||
Django Translatable Fields - Odoo-style translatable fields for Django
|
||||
@@ -0,0 +1,13 @@
|
||||
setup.py
|
||||
django_translatable_fields.egg-info/PKG-INFO
|
||||
django_translatable_fields.egg-info/SOURCES.txt
|
||||
django_translatable_fields.egg-info/dependency_links.txt
|
||||
django_translatable_fields.egg-info/entry_points.txt
|
||||
django_translatable_fields.egg-info/not-zip-safe
|
||||
django_translatable_fields.egg-info/requires.txt
|
||||
django_translatable_fields.egg-info/top_level.txt
|
||||
management/__init__.py
|
||||
management/commands/__init__.py
|
||||
management/commands/makemigrations_translatable.py
|
||||
templatetags/__init__.py
|
||||
templatetags/translatable_tags.py
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[console_scripts]
|
||||
translatable-migrate = django_translatable_fields.management.commands.makemigrations_translatable:main
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
Django<6.0,>=4.2
|
||||
psycopg2-binary>=2.9.0
|
||||
|
||||
[dev]
|
||||
pytest>=7.0.0
|
||||
pytest-django>=4.5.0
|
||||
black>=22.0.0
|
||||
flake8>=4.0.0
|
||||
mypy>=0.991
|
||||
|
||||
[postgres]
|
||||
psycopg2-binary>=2.9.0
|
||||
@@ -0,0 +1,2 @@
|
||||
management
|
||||
templatetags
|
||||
@@ -75,7 +75,7 @@ class TranslatableMixin:
|
||||
|
||||
# Check if we're in admin context by looking at the call stack
|
||||
frames = inspect.getouterframes(inspect.currentframe())
|
||||
is_admin_context = any('admin' in frame.filename or 'forms' in frame.filename for frame in frames[:5])
|
||||
is_admin_context = os.environ.get('DJANGO_ADMIN_OVERRIDE', False) == '1' or any('admin' in frame.filename or 'forms' in frame.filename for frame in frames[:5])
|
||||
|
||||
logging.debug(f"{self.__class__.__name__} from_db_value - admin context: {is_admin_context}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user