Skip to content

Commit

Permalink
fix: Add content__language as a field to PostAdmin
Browse files Browse the repository at this point in the history
This is necessary as GrouperModelAdmin instances are required to include
the extra grouping fields in their fieldsets.
  • Loading branch information
GaretJax committed Aug 16, 2024
1 parent 312859d commit dc8f8bc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions djangocms_blog/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def queryset(self, request, queryset):
class ModelAppHookConfig:
app_config_selection_title = _("Select app config")
app_config_selection_desc = _("Select the app config for the new object")
app_config_initial_fields = ("app_config",)
app_config_values = {}

def _app_config_select(self, request, obj):
Expand Down Expand Up @@ -177,7 +178,7 @@ def get_fieldsets(self, request, obj=None):
(
_(self.app_config_selection_title),
{
"fields": ("app_config",),
"fields": self.app_config_initial_fields,
"description": _(self.app_config_selection_desc),
},
),
Expand Down Expand Up @@ -233,10 +234,7 @@ def get_form(self, request, obj=None, **kwargs):

class InitialForm(form):
class Meta(form.Meta):
fields = (
"app_config",
"language",
)
fields = self.app_config_initial_fields

form = InitialForm
form = self._set_config_defaults(request, form, obj)
Expand Down Expand Up @@ -293,6 +291,7 @@ class PostAdmin(
GrouperModelAdmin,
):
# form = PostAdminForm
app_config_initial_fields = ("app_config", "content__language")
extra_grouping_fields = ("language",)
inlines = []
list_display = ("title", "author", "app_config", "state_indicator", "admin_list_actions")
Expand Down

0 comments on commit dc8f8bc

Please sign in to comment.