admin.py 1001 Bytes
Newer Older
Thom Wiggers's avatar
Thom Wiggers committed
1
from django.contrib import admin
2
from utils.translation import TranslatedModelAdmin
Thom Wiggers's avatar
Thom Wiggers committed
3
4
5

from . import models

6

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

11
12
13
14
15
16
17
18
19
    fieldsets = (
        (None, {
            'fields': (
                'name', 'description', 'photo', 'permissions',
                'since', 'until'
            )
        }),
    )

Thom Wiggers's avatar
Thom Wiggers committed
20
21
22
23
24
25
    def get_queryset(self, request):
        qs = super().get_queryset(request)
        return qs.exclude(board__is_board=True)


@admin.register(models.Board)
26
class BoardAdmin(TranslatedModelAdmin):
Thom Wiggers's avatar
Thom Wiggers committed
27
    exclude = ('is_board',)
Thom Wiggers's avatar
Thom Wiggers committed
28

29
30
31
32
33
34
35
36
37
    fieldsets = (
        (None, {
            'fields': (
                'description', 'photo', 'permissions',
                'since', 'until'
            )
        }),
    )

Thom Wiggers's avatar
Thom Wiggers committed
38
39
40
41

@admin.register(models.CommitteeMembership)
class CommitteeMembershipAdmin(admin.ModelAdmin):
    pass
42
43
44
45
46


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