-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Description
Hi,
Just asking, there is a ways filtring by active lang like :
from django.db import models
from localized_fields.fields import LocalizedCharField
from localized_fields.models import LocalizedModel
from django.utils.translation import activate
class MyModel(LocalizedModel, models.Model):
name = LocalizedCharField(required=True)
"""
If MyModel instance are:
{
'name': {
'en': foo,
'es': bar
}
}
"""
activate('en') # Active lang 'en'
MyModel.objects.filter(name='foo') # Find all instance that have name['en'] = 'foo'
MyModel.objects.filter(name__contains='foo') # Find all instance that have name['en'] = '%foo%'
Thx ;)
Metadata
Metadata
Assignees
Labels
No labels