mirror of
				https://github.com/SectorLabs/django-localized-fields.git
				synced 2025-10-31 02:48:56 +03:00 
			
		
		
		
	Restore LocalizedModel to its former glory as an convient way to get all the mixins
This commit is contained in:
		| @@ -1,21 +1,16 @@ | |||||||
| from django.db import models | from psqlextra.models import PostgresModel | ||||||
| from django.core.checks import Warning |  | ||||||
|  | from .mixins import AtomicSlugRetryMixin | ||||||
|  |  | ||||||
|  |  | ||||||
| class LocalizedModel(models.Model): | class LocalizedModel(AtomicSlugRetryMixin, PostgresModel): | ||||||
|     """A model keeped for backwards compatibility""" |     """Turns a model into a model that contains LocalizedField's. | ||||||
|  |  | ||||||
|     @classmethod |     For basic localisation functionality, it isn't needed to inherit | ||||||
|     def check(cls, **kwargs): |     from LocalizedModel. However, for certain features, this is required. | ||||||
|         errors = super().check(**kwargs) |  | ||||||
|         errors.append( |     It is definitely needed for :see:LocalizedUniqueSlugField, unless you | ||||||
|             Warning( |     manually inherit from AtomicSlugRetryMixin.""" | ||||||
|                 'localized_fields.LocalizedModel is deprecated', |  | ||||||
|                 hint='There is no need to use localized_fields.LocalizedModel', |  | ||||||
|                 obj=cls |  | ||||||
|             ) |  | ||||||
|         ) |  | ||||||
|         return errors |  | ||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|         abstract = True |         abstract = True | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user