Skip to content

Commit c48abdf

Browse files
committed
fix remarks
1 parent e233204 commit c48abdf

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class MovieAdmin(SingleItemActionMixin, admin.ModelAdmin):
8686

8787
## Grouping actions
8888

89-
The list of actions is "flat". We can add item groups, just like in other Django `ChoiceField`s. For this we introduced the `GroupedActionAdminMixin`.
89+
The list of actions is "flat". We can add item groups, just like in other Django `ChoiceField`s. For this, we introduced the `GroupedActionAdminMixin`.
9090

9191
This mixin looks at the actions. We also defined a `@grouped_action` decorator, which does approximately the same as the `@admin.action` decorator, except with an extra parameter `action_group=…`.
9292

@@ -113,4 +113,4 @@ class MovieAdmin(GroupedActionAdminMixin, admin.ModelAdmin):
113113
#
114114
```
115115

116-
The order of the groups is determined by the order of the indivual actions: the first action for that group for each group determines how the groups are listed.
116+
The order of the groups is determined by the order of the individual actions: the first action for that group for each group determines how the groups are listed.

django_adminlink/admin.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,9 @@ def decorator(func):
144144
return func
145145

146146
return decorator
147-
else:
148-
function = admin.action(function)
149-
function.action_group = action_group
150-
return function
147+
function = admin.action(function)
148+
function.action_group = action_group
149+
return function
151150

152151

153152
class GroupedActionAdminMixin:
@@ -158,7 +157,7 @@ def get_action_choices(self, request, default_choices=models.BLANK_CHOICE_DASH):
158157
group = getattr(func, "action_group", None)
159158
choice = (name, description % model_format_dict(self.opts))
160159
grouped_items[group].append(choice)
161-
return [(k, v) for k, v in grouped_items.items()]
160+
return list(grouped_items.items())
162161

163162

164163
class GroupedActionAdmin(SingleItemActionMixin, admin.ModelAdmin):

0 commit comments

Comments
 (0)