1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2025-06-21 14:38:22 +02:00

Move emprunt button

This commit is contained in:
Alexandre Iooss
2019-08-10 15:53:23 +02:00
parent 82ebc60982
commit 8613dd2810
6 changed files with 25 additions and 49 deletions

View File

@ -59,7 +59,7 @@ class UserAdmin(VersionAdmin, BaseUserAdmin):
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
list_display = ('username', 'email', 'first_name', 'last_name',
'maxemprunt', 'is_adherent', 'is_staff', 'actions_btn')
'maxemprunt', 'is_adherent', 'is_staff')
list_filter = (IsAdherentFilter, 'is_staff', 'is_superuser', 'is_active',
'groups')
@ -114,17 +114,6 @@ class UserAdmin(VersionAdmin, BaseUserAdmin):
is_adherent.short_description = _('is adherent')
is_adherent.allow_tags = True
def actions_btn(self, obj):
# TODO permit adhere only if perms.media.add_emprunt
return format_html(
'<a class="button" href="{}">{}</a>',
reverse('media:add-emprunt', args=[obj.pk]),
_('Register borrowed item')
)
actions_btn.short_description = _('actions')
actions_btn.allow_tags = True
admin_site.register(User, UserAdmin)
admin_site.register(Adhesion, AdhesionAdmin)