Skip to content
Snippets Groups Projects

Add alias searching to mailinglists and show them in the admin overview

Merged Ghost User requested to merge feature/422-mailinglist-search into master
All threads resolved!
1 file
+ 8
1
Compare changes
  • Side-by-side
  • Inline
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from members.models import Member
from .models import ListAlias, MailingList, VerbatimAddress
@@ -13,7 +14,13 @@ class ListAliasInline(admin.TabularInline):
@admin.register(MailingList)
class GeneralMeetingAdmin(admin.ModelAdmin):
class MailingListAdmin(admin.ModelAdmin):
model = Member
filter_horizontal = ('members',)
inlines = (VerbatimAddressInline, ListAliasInline)
list_display = ('name', 'alias_names',)
search_fields = ['name', 'prefix', 'aliasses__alias']
def alias_names(self, obj):
return [x.alias for x in obj.aliasses.all()]
alias_names.short_description = _('List aliasses')
Loading