Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
e0367428
Verified
Commit
e0367428
authored
May 17, 2017
by
Sébastiaan Versteeg
Browse files
Add alias searching to mailinglists and show them in the admin overview
parent
0a3e2216
Changes
1
Hide whitespace changes
Inline
Side-by-side
website/mailinglists/admin.py
View file @
e0367428
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
GeneralMeeting
Admin
(
admin
.
ModelAdmin
):
class
MailingList
Admin
(
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'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment