mirror of
https://github.com/SectorLabs/django-localized-fields.git
synced 2025-04-24 19:32:53 +03:00
commit
53d7cd0c66
@ -20,7 +20,7 @@ jobs:
|
||||
|
||||
- run:
|
||||
name: Run tests
|
||||
command: tox -e 'py37-dj{20,21,22}'
|
||||
command: tox -e 'py37-dj{20,21,22,30}'
|
||||
environment:
|
||||
DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'
|
||||
|
||||
@ -47,7 +47,7 @@ jobs:
|
||||
|
||||
- run:
|
||||
name: Run tests
|
||||
command: tox -e 'py38-dj{20,21,22}'
|
||||
command: tox -e 'py38-dj{20,21,22,30}'
|
||||
environment:
|
||||
DATABASE_URL: 'postgres://localizedfields:localizedfields@localhost:5432/localizedfields'
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
| :white_check_mark: | **Tests** | [](https://circleci.com/gh/SectorLabs/django-localized-fields/tree/master) |
|
||||
| :memo: | **License** | [](http://doge.mit-license.org) |
|
||||
| :package: | **PyPi** | [](https://pypi.python.org/pypi/django-localized-fields) |
|
||||
| <img src="https://icon-library.net/images/django-icon/django-icon-0.jpg" width="22px" height="22px" align="center" /> | **Django Versions** | 2.0, 2.1, 2.2 |
|
||||
| <img src="https://icon-library.net/images/django-icon/django-icon-0.jpg" width="22px" height="22px" align="center" /> | **Django Versions** | 2.0, 2.1, 2.2, 3.0 |
|
||||
| <img src="http://www.iconarchive.com/download/i73027/cornmanthe3rd/plex/Other-python.ico" width="22px" height="22px" align="center" /> | **Python Versions** | 3.7, 3.8 |
|
||||
| :book: | **Documentation** | [Read The Docs](https://django-localized-fields.readthedocs.io) |
|
||||
| :warning: | **Upgrade** | [Upgrade fom v5.x](https://django-localized-fields.readthedocs.io/en/latest/releases.html#v6-0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from django.conf import settings
|
||||
from django.utils import six, translation
|
||||
from django.utils import translation
|
||||
|
||||
|
||||
class LocalizedValueDescriptor:
|
||||
@ -57,7 +57,7 @@ class LocalizedValueDescriptor:
|
||||
return instance.__dict__[self.field.name]
|
||||
|
||||
def __set__(self, instance, value):
|
||||
if isinstance(value, six.string_types):
|
||||
if isinstance(value, str):
|
||||
language = translation.get_language() or settings.LANGUAGE_CODE
|
||||
self.__get__(instance).set(
|
||||
language, value
|
||||
|
@ -5,7 +5,6 @@ import posixpath
|
||||
from django.core.files import File
|
||||
from django.core.files.storage import default_storage
|
||||
from django.db.models.fields.files import FieldFile
|
||||
from django.utils import six
|
||||
from django.utils.encoding import force_str, force_text
|
||||
|
||||
from localized_fields.fields import LocalizedField
|
||||
@ -56,7 +55,7 @@ class LocalizedFileValueDescriptor(LocalizedValueDescriptor):
|
||||
def __get__(self, instance, cls=None):
|
||||
value = super().__get__(instance, cls)
|
||||
for lang, file in value.__dict__.items():
|
||||
if isinstance(file, six.string_types) or file is None:
|
||||
if isinstance(file, str) or file is None:
|
||||
file = self.field.value_class(instance, self.field, file, lang)
|
||||
value.set(lang, file)
|
||||
|
||||
@ -120,7 +119,7 @@ class LocalizedFileField(LocalizedField):
|
||||
else:
|
||||
# Need to convert File objects provided via a form to
|
||||
# unicode for database insertion
|
||||
prep_value.set(k, six.text_type(v))
|
||||
prep_value.set(k, str(v))
|
||||
return super().get_prep_value(prep_value)
|
||||
return super().get_prep_value(value)
|
||||
|
||||
|
3
tox.ini
3
tox.ini
@ -1,11 +1,12 @@
|
||||
[tox]
|
||||
envlist = py37-dj{20,21,22}, py38-dj{20,21,22}
|
||||
envlist = py37-dj{20,21,22,30}, py38-dj{20,21,22,30}
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
dj20: Django>=2.0,<2.1
|
||||
dj21: Django>=2.1,<2.2
|
||||
dj22: Django>=2.2,<2.3
|
||||
dj30: Django>=3.0a1,<3.1
|
||||
-rrequirements/test.txt
|
||||
setenv =
|
||||
DJANGO_SETTINGS_MODULE=settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user