|
@@ -70,14 +70,14 @@ class UserIsAdherentFilter(admin.SimpleListFilter):
|
|
|
|
|
|
|
|
|
class UserAdmin(AuthUserAdmin):
|
|
|
- list_display = AuthUserAdmin.list_display + ('adherent_id',)
|
|
|
+ list_display = AuthUserAdmin.list_display + ('get_adhesion_link',)
|
|
|
list_filter = (AuthUserAdmin.list_filter[2], UserIsAdherentFilter) # [2] = actif
|
|
|
|
|
|
- def adherent_id(self, user):
|
|
|
- adherent = user.adhesion
|
|
|
- if adherent:
|
|
|
- return adherent.id
|
|
|
- adherent_id.short_description = 'Numéro d’adhérent'
|
|
|
+ def get_adhesion_link(self, user):
|
|
|
+ adhesion = user.adhesion
|
|
|
+ if adhesion:
|
|
|
+ return adhesion.get_adhesion_link()
|
|
|
+ get_adhesion_link.short_description = 'Numéro d’adhérent'
|
|
|
|
|
|
def get_form(self, request, obj=None, **kwargs):
|
|
|
if obj:
|
|
@@ -179,16 +179,16 @@ class AdhesionAdmin(admin.ModelAdmin):
|
|
|
|
|
|
|
|
|
class CorporationAdmin(admin.ModelAdmin):
|
|
|
- list_display = ('social_reason', 'adherent_id')
|
|
|
+ list_display = ('social_reason', 'get_adhesion_link')
|
|
|
inlines = (AdhesionInline,)
|
|
|
search_fields = ('social_reason',)
|
|
|
filter_horizontal = ('members',)
|
|
|
|
|
|
- def adherent_id(self, corporation):
|
|
|
- adherent = corporation.adhesion
|
|
|
- if adherent:
|
|
|
- return adherent.id
|
|
|
- adherent_id.short_description = 'Numéro d’adhérent'
|
|
|
+ def get_adhesion_link(self, corp):
|
|
|
+ adhesion = corp.adhesion
|
|
|
+ if adhesion:
|
|
|
+ return adhesion.get_adhesion_link()
|
|
|
+ get_adhesion_link.short_description = 'Numéro d’adhérent'
|
|
|
|
|
|
def get_actions(self, request):
|
|
|
actions = super().get_actions(request)
|