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