First of all, thank you for creating this package!
I've the following table:
# parts
- name (default)
- name_en (translated)
- name_es (translated)
When filling name_en and name_es via the django admin panel, name is also set, even if I keep it empty. The value is taken from either name_es or name_en, depending on my current locale.
As I've to support more than 2 languages and editors from several countries, the default field name would become a mess IMO. It's also redundant.
Question
Is there a way to keep it empty or even avoid name_en and use name instead?
Code extraction
# settings.py
LANGUAGES = (
('en', gettext('English')),
('es', gettext('Spanish')),
)
# app/models.py
class Part(models.Model):
name = models.CharField(max_length=100, blank=True, default='')
# app/serializer.py
class PartSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Part
fields = ['name']
# app/views.py
class PartViewSet(viewsets.ModelViewSet):
queryset = Part.objects.all()
serializer_class = PartSerializer
Note: I'm using the django-restframework, but the caveat mentioned in your docs shouldn't affect the current issue, afaik:
When creating a new viewset , make sure to override get_queryset method, using queryset as a property won’t work because it is being evaluated once, before any language was set.
Hi folks!
First of all, thank you for creating this package!
I've the following table:
When filling
name_en
andname_es
via the django admin panel,name
is also set, even if I keep it empty. The value is taken from eithername_es
orname_en
, depending on my current locale.As I've to support more than 2 languages and editors from several countries, the default field
name
would become a mess IMO. It's also redundant.Question Is there a way to keep it empty or even avoid
name_en
and usename
instead?Code extraction
Note: I'm using the
django-restframework
, but the caveat mentioned in your docs shouldn't affect the current issue, afaik:Thanks in advance!