diff --git a/djangocms_blog/admin.py b/djangocms_blog/admin.py index dda9f54..9b04320 100755 --- a/djangocms_blog/admin.py +++ b/djangocms_blog/admin.py @@ -332,7 +332,7 @@ class PostAdmin(PlaceholderAdminMixin, FrontendEditableAdminMixin, if apps.is_installed('djangocms_blog.liveblog'): fsets[2][1]['fields'][2].append('enable_liveblog') filter_function = get_setting('ADMIN_POST_FIELDSET_FILTER') - if related: + if related and Post.objects.namespace(config.namespace).active_translations().exists(): fsets[1][1]['fields'][0].append('related') if callable(filter_function): fsets = filter_function(fsets, request, obj=obj) diff --git a/djangocms_blog/forms.py b/djangocms_blog/forms.py index 1ba16fd..0c651c5 100644 --- a/djangocms_blog/forms.py +++ b/djangocms_blog/forms.py @@ -94,7 +94,7 @@ class PostAdminFormBase(ConfigFormBase, TranslatableModelForm): def available_categories(self): qs = BlogCategory.objects if self.app_config: - return qs.namespace(self.app_config.namespace) + return qs.namespace(self.app_config.namespace).active_translations() return qs diff --git a/tests/test_models.py b/tests/test_models.py index dbf90da..eb54549 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -304,6 +304,10 @@ class AdminTest(BaseTest): self.app_config_1.app_data.config.use_related = True self.app_config_1.save() fsets = post_admin.get_fieldsets(request) + self.assertFalse('related' in fsets[1][1]['fields'][0]) + + Post.objects.language('en').create(title='post x', app_config=self.app_config_1) + fsets = post_admin.get_fieldsets(request) self.assertTrue('related' in fsets[1][1]['fields'][0]) self.app_config_1.app_data.config.use_related = False