mirror of
				https://github.com/SectorLabs/django-localized-fields.git
				synced 2025-10-25 00:28:57 +03:00 
			
		
		
		
	Compare commits
	
		
			14 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | a198440a64 | ||
|  | 5945c3f531 | ||
|  | 3fd862ce4d | ||
|  | dad7f164cd | ||
|  | 6490f3908c | ||
|  | 54ad6eb434 | ||
|  | 893fe0f5ab | ||
|  | 3de1492a58 | ||
|  | 946e9a67c4 | ||
|  | 36f6e946b0 | ||
|  | 909ebfee69 | ||
|  | 95284e6fd0 | ||
|  | e84a5e4ff1 | ||
|  | 472c7bbc41 | 
							
								
								
									
										18
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								.travis.yml
									
									
									
									
									
								
							| @@ -1,18 +0,0 @@ | ||||
| env: | ||||
|  - DJANGO_SETTINGS_MODULE=settings | ||||
| sudo: true | ||||
| before_install: | ||||
|   - sudo apt-get update -qq | ||||
|   - sudo apt-get install -qq build-essential gettext python-dev zlib1g-dev libpq-dev xvfb | ||||
|   - sudo apt-get install -qq libtiff4-dev libjpeg8-dev libfreetype6-dev liblcms1-dev libwebp-dev | ||||
|   - sudo apt-get install -qq graphviz-dev python-setuptools python3-dev python-virtualenv python-pip | ||||
|   - sudo apt-get install -qq firefox automake libtool libreadline6 libreadline6-dev libreadline-dev | ||||
|   - sudo apt-get install -qq libsqlite3-dev libxml2 libxml2-dev libssl-dev libbz2-dev wget curl llvm | ||||
| language: python | ||||
| python: | ||||
| - "3.5" | ||||
| services: | ||||
|  - postgresql | ||||
| install: "pip install -r requirements/test.txt" | ||||
| script: | ||||
|     - coverage run manage.py test | ||||
							
								
								
									
										21
									
								
								README.rst
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								README.rst
									
									
									
									
									
								
							| @@ -1,8 +1,8 @@ | ||||
| django-localized-fields | ||||
| ======================= | ||||
|  | ||||
| .. image:: https://circleci.com/gh/SectorLabs/django-localized-fields.svg?style=svg | ||||
|     :target: https://circleci.com/gh/SectorLabs/django-localized-fields | ||||
| .. image:: https://circleci.com/gh/SectorLabs/django-localized-fields/tree/v5.x.svg?style=svg | ||||
|     :target: https://circleci.com/gh/SectorLabs/django-localized-fields/tree/v5.x | ||||
|  | ||||
| .. image:: https://img.shields.io/github/license/SectorLabs/django-localized-fields.svg | ||||
|     :target: https://github.com/SectorLabs/django-localized-fields/blob/master/LICENSE.md | ||||
| @@ -14,11 +14,17 @@ django-localized-fields | ||||
|  | ||||
| This package requires Python 3.5 or newer, Django 1.11 or newer and PostgreSQL 9.6 or newer. | ||||
|  | ||||
| ---- | ||||
|  | ||||
| **This README is for v5.x. Check out the master branch for v6.x and newer.** | ||||
|  | ||||
| ---- | ||||
|  | ||||
| Contributors | ||||
| ------------ | ||||
|  | ||||
| * `seroy <https://github.com/seroy/>`_ | ||||
| * `unaizalakain <https://github.com/unaizalakain/>`_ | ||||
| * `umazalakain <https://github.com/umazalakain/>`_ | ||||
|  | ||||
| Installation | ||||
| ------------ | ||||
| @@ -26,7 +32,7 @@ Installation | ||||
|  | ||||
|     .. code-block:: bash | ||||
|  | ||||
|         $ pip install django-localized-fields | ||||
|         $ pip install django-localized-fields==5.4.1 | ||||
|  | ||||
| 2. Add ``localized_fields`` and ``django.contrib.postgres`` to your ``INSTALLED_APPS``: | ||||
|  | ||||
| @@ -61,6 +67,13 @@ Installation | ||||
|              ('ro', 'Romanian') | ||||
|          ) | ||||
|  | ||||
|  | ||||
| 4. Apply migrations to enable the HStore extension: | ||||
|  | ||||
|      .. code-block:: bash | ||||
|  | ||||
| 	 python manage.py migrate | ||||
|  | ||||
| Usage | ||||
| ----- | ||||
|  | ||||
|   | ||||
| @@ -17,17 +17,17 @@ class LocalizedAutoSlugField(LocalizedField): | ||||
|     """Automatically provides slugs for a localized | ||||
|     field upon saving.""" | ||||
|  | ||||
|     warnings.warn( | ||||
|         'LocalizedAutoSlug is deprecated and will be removed in the next major version.', | ||||
|         DeprecationWarning | ||||
|     ) | ||||
|  | ||||
|     def __init__(self, *args, **kwargs): | ||||
|         """Initializes a new instance of :see:LocalizedAutoSlugField.""" | ||||
|  | ||||
|         self.populate_from = kwargs.pop('populate_from', None) | ||||
|         self.include_time = kwargs.pop('include_time', False) | ||||
|  | ||||
|         warnings.warn( | ||||
|             'LocalizedAutoSlug is deprecated and will be removed in the next major version.', | ||||
|             DeprecationWarning | ||||
|         ) | ||||
|  | ||||
|         super(LocalizedAutoSlugField, self).__init__( | ||||
|             *args, | ||||
|             **kwargs | ||||
|   | ||||
| @@ -1,7 +1,8 @@ | ||||
| import deprecation | ||||
| import collections | ||||
|  | ||||
| from typing import Optional | ||||
| from collections.abc import Iterable | ||||
|  | ||||
| from django.conf import settings | ||||
| from django.utils import translation | ||||
|  | ||||
| @@ -97,7 +98,7 @@ class LocalizedValue(dict): | ||||
|                 lang_value = value.get(lang_code, self.default_value) | ||||
|                 self.set(lang_code, lang_value) | ||||
|  | ||||
|         elif isinstance(value, collections.Iterable): | ||||
|         elif isinstance(value, Iterable): | ||||
|             for val in value: | ||||
|                 self._interpret_value(val) | ||||
|  | ||||
|   | ||||
| @@ -1,2 +1,2 @@ | ||||
| django-postgres-extra==1.21a9 | ||||
| deprecation==2.0.3 | ||||
| django-postgres-extra==1.22 | ||||
| deprecation==2.0.7 | ||||
|   | ||||
							
								
								
									
										23
									
								
								settings.py
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								settings.py
									
									
									
									
									
								
							| @@ -24,10 +24,33 @@ INSTALLED_APPS = ( | ||||
|     'django.contrib.auth', | ||||
|     'django.contrib.contenttypes', | ||||
|     'django.contrib.admin', | ||||
|     'django.contrib.messages', | ||||
|     'localized_fields', | ||||
|     'tests', | ||||
| ) | ||||
|  | ||||
| TEMPLATES = [ | ||||
|     { | ||||
|         "BACKEND": "django.template.backends.django.DjangoTemplates", | ||||
|         "DIRS": [], | ||||
|         "APP_DIRS": True, | ||||
|         "OPTIONS": { | ||||
|             "context_processors": [ | ||||
|                 "django.template.context_processors.debug", | ||||
|                 "django.template.context_processors.request", | ||||
|                 "django.contrib.auth.context_processors.auth", | ||||
|                 "django.contrib.messages.context_processors.messages", | ||||
|             ], | ||||
|         }, | ||||
|     }, | ||||
| ] | ||||
|  | ||||
| MIDDLEWARE = [ | ||||
|     'django.contrib.messages.middleware.MessageMiddleware', | ||||
|     'django.contrib.sessions.middleware.SessionMiddleware', | ||||
|     'django.contrib.auth.middleware.AuthenticationMiddleware', | ||||
| ] | ||||
|  | ||||
| # set to a lower number than the default, since | ||||
| # we want the tests to be fast, default is 100 | ||||
| LOCALIZED_FIELDS_MAX_RETRIES = 3 | ||||
|   | ||||
							
								
								
									
										6
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								setup.py
									
									
									
									
									
								
							| @@ -33,7 +33,7 @@ with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8 | ||||
|  | ||||
| setup( | ||||
|     name='django-localized-fields', | ||||
|     version='5.0a11', | ||||
|     version='5.4.1', | ||||
|     packages=find_packages(exclude=['tests']), | ||||
|     include_package_data=True, | ||||
|     license='MIT License', | ||||
| @@ -44,9 +44,9 @@ setup( | ||||
|     author_email='open-source@sectorlabs.ro', | ||||
|     keywords=['django', 'localized', 'language', 'models', 'fields'], | ||||
|     install_requires=[ | ||||
|         'django-postgres-extra>=1.22', | ||||
|         'django-postgres-extra>=1.22,<2.0', | ||||
|         'Django>=1.11', | ||||
|         'deprecation==2.0.3' | ||||
|         'deprecation==2.0.7' | ||||
|     ], | ||||
|     classifiers=[ | ||||
|         'Environment :: Web Environment', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user