admin.py 926 Bytes
Newer Older
Thom Wiggers's avatar
Thom Wiggers committed
1
from django.contrib import admin
2

3
from utils.translation import TranslatedModelAdmin
Thom Wiggers's avatar
Thom Wiggers committed
4
5
6

from . import models

7

Thom Wiggers's avatar
Thom Wiggers committed
8
@admin.register(models.Committee)
9
class CommitteeAdmin(TranslatedModelAdmin):
Thom Wiggers's avatar
Thom Wiggers committed
10
11
    list_filter = ('until',)

12
    fields = ('name', 'description', 'photo', 'permissions',
Thom Wiggers's avatar
Thom Wiggers committed
13
              'since', 'until', 'contact_email', 'wiki_namespace', 'active')
14

Thom Wiggers's avatar
Thom Wiggers committed
15
16
17
18
19
20
    def get_queryset(self, request):
        qs = super().get_queryset(request)
        return qs.exclude(board__is_board=True)


@admin.register(models.Board)
21
class BoardAdmin(TranslatedModelAdmin):
Thom Wiggers's avatar
Thom Wiggers committed
22
    exclude = ('is_board',)
Thom Wiggers's avatar
Thom Wiggers committed
23

24
    fields = ('name', 'photo', 'permissions',
25
              'since', 'until',)
26

Thom Wiggers's avatar
Thom Wiggers committed
27
28

@admin.register(models.CommitteeMembership)
29
class CommitteeMembershipAdmin(TranslatedModelAdmin):
30
    list_display = ('member', 'committee', 'since', 'until', 'chair', 'role')
31
32
33
34
35


@admin.register(models.Mentorship)
class MentorsAdmin(admin.ModelAdmin):
    pass