mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-13 10:36:25 +01:00
update code to reflect the new minimum python version 3.7
- update string format method - remove redundant default arguments from function calls - remove unused imports - remove unicode identifier from strings, it's default in py3 (see: https://stackoverflow.com/a/4182635/12201331)
This commit is contained in:
@@ -36,8 +36,8 @@ def make_service_hooks_update_groups_action(service):
|
||||
for user in queryset: # queryset filtering doesn't work here?
|
||||
service.update_groups(user)
|
||||
|
||||
update_service_groups.__name__ = str('update_{}_groups'.format(slugify(service.name)))
|
||||
update_service_groups.short_description = "Sync groups for selected {} accounts".format(service.title)
|
||||
update_service_groups.__name__ = str(f'update_{slugify(service.name)}_groups')
|
||||
update_service_groups.short_description = f"Sync groups for selected {service.title} accounts"
|
||||
return update_service_groups
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ def make_service_hooks_sync_nickname_action(service):
|
||||
for user in queryset: # queryset filtering doesn't work here?
|
||||
service.sync_nickname(user)
|
||||
|
||||
sync_nickname.__name__ = str('sync_{}_nickname'.format(slugify(service.name)))
|
||||
sync_nickname.short_description = "Sync nicknames for selected {} accounts".format(service.title)
|
||||
sync_nickname.__name__ = str(f'sync_{slugify(service.name)}_nickname')
|
||||
sync_nickname.short_description = f"Sync nicknames for selected {service.title} accounts"
|
||||
return sync_nickname
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ class MainCorporationsFilter(admin.SimpleListFilter):
|
||||
.distinct()\
|
||||
.order_by(Lower('corporation_name'))
|
||||
return tuple(
|
||||
[(x['corporation_id'], x['corporation_name']) for x in qs]
|
||||
(x['corporation_id'], x['corporation_name']) for x in qs
|
||||
)
|
||||
|
||||
def queryset(self, request, qs):
|
||||
@@ -228,7 +228,7 @@ class MainAllianceFilter(admin.SimpleListFilter):
|
||||
.distinct()\
|
||||
.order_by(Lower('alliance_name'))
|
||||
return tuple(
|
||||
[(x['alliance_id'], x['alliance_name']) for x in qs]
|
||||
(x['alliance_id'], x['alliance_name']) for x in qs
|
||||
)
|
||||
|
||||
def queryset(self, request, qs):
|
||||
@@ -252,7 +252,7 @@ def update_main_character_model(modeladmin, request, queryset):
|
||||
|
||||
modeladmin.message_user(
|
||||
request,
|
||||
'Update from ESI started for {} characters'.format(tasks_count)
|
||||
f'Update from ESI started for {tasks_count} characters'
|
||||
)
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ class UserAdmin(BaseUserAdmin):
|
||||
_state.admin_order_field = 'profile__state'
|
||||
|
||||
def _groups(self, obj):
|
||||
my_groups = sorted([group.name for group in list(obj.groups.all())])
|
||||
my_groups = sorted(group.name for group in list(obj.groups.all()))
|
||||
return self._list_2_html_w_tooltips(
|
||||
my_groups, AUTHENTICATION_ADMIN_USERS_MAX_GROUPS
|
||||
)
|
||||
@@ -455,7 +455,7 @@ class StateAdmin(admin.ModelAdmin):
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
if obj == get_guest_state():
|
||||
return False
|
||||
return super(StateAdmin, self).has_delete_permission(request, obj=obj)
|
||||
return super().has_delete_permission(request, obj=obj)
|
||||
|
||||
def get_fieldsets(self, request, obj=None):
|
||||
if obj == get_guest_state():
|
||||
@@ -464,7 +464,7 @@ class StateAdmin(admin.ModelAdmin):
|
||||
'fields': ('permissions', 'priority'),
|
||||
}),
|
||||
)
|
||||
return super(StateAdmin, self).get_fieldsets(request, obj=obj)
|
||||
return super().get_fieldsets(request, obj=obj)
|
||||
|
||||
|
||||
class BaseOwnershipAdmin(admin.ModelAdmin):
|
||||
|
||||
Reference in New Issue
Block a user