Skip to content

Commit

Permalink
export to ios and android only the localizedstring that has status ==…
Browse files Browse the repository at this point in the history
… published. close #47
  • Loading branch information
michaelhenry committed Mar 30, 2019
1 parent e1f2539 commit 429228c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/Localizr/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class LocalizedStringAdmin(BaseModelAdmin, ImportExportModelAdmin):

fieldsets = (
('LocalizedString', {
'fields': ('key_string', 'locale', 'value',)
'fields': ('key_string', 'locale', 'value', 'status',)
}),
('Metadata (Read-only)', {
'fields': ('created_by', 'created', 'modified_by', 'modified',)
Expand Down
7 changes: 5 additions & 2 deletions apps/Localizr/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ class AppInfoKeyStringQuerySet(models.QuerySet):
def filter_by_locale_code(self, locale_code):

base_value = LocalizedString.objects.filter(
locale=OuterRef('app_info__base_locale')
locale=OuterRef('app_info__base_locale'),
status=LocalizedString.STATUS_PUBLISHED,
).filter(
key_string=OuterRef('key_string'),
).values_list('value',flat=True)

value = LocalizedString.objects.filter(
locale__code=locale_code
locale__code=locale_code,
status=LocalizedString.STATUS_PUBLISHED,
).filter(
key_string=OuterRef('key_string'),
).values_list('value',flat=True)
Expand All @@ -139,6 +141,7 @@ def filter_by_locale_code(self, locale_code):
value=Coalesce(
Subquery(value),
Subquery(base_value)))\
.exclude(value=None)\
.values_list('key','value', 'modified',)


Expand Down

0 comments on commit 429228c

Please sign in to comment.