Skip to content
Snippets Groups Projects
Unverified Commit e2e2d196 authored by florimondmanca's avatar florimondmanca
Browse files

refactor participation user link display field

parent 4147b626
Branches refactor/participation-user-link
No related tags found
1 merge request!5Refactor participation user link display field
...@@ -113,14 +113,16 @@ reject_selected_participations.short_description = ( ...@@ -113,14 +113,16 @@ reject_selected_participations.short_description = (
class ParticipationAdmin(admin.ModelAdmin): class ParticipationAdmin(admin.ModelAdmin):
"""Admin panel for visit participations.""" """Admin panel for visit participations."""
list_display = ('submitted', 'visit', 'user_link', list_display = ('submitted', 'visit', 'user_link', 'accepted', 'present')
'accepted', 'present')
list_filter = ('submitted', 'accepted', 'present') list_filter = ('submitted', 'accepted', 'present')
actions = [accept_selected_participations, reject_selected_participations] actions = [accept_selected_participations, reject_selected_participations]
def user_link (self,book):
url=reverse("admin:users_user_change", args=[book.user.id]) def user_link(self, participation: Participation):
link = '<a href="%s">%s</a>' % (url, book.user.email) """Return a link to the participation's user."""
url = reverse("admin:users_user_change", args=[participation.user.id])
link = f'<a href="{url}">{participation.user}</a>'
return mark_safe(link) return mark_safe(link)
user_link.short_description = 'Utilisateur' user_link.short_description = 'Utilisateur'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment