forked from postgres/pgcommitfest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
72 lines (55 loc) · 1.52 KB
/
admin.py
File metadata and controls
72 lines (55 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from django.contrib import admin
from django.forms import widgets
from .models import (
CfbotBranch,
CfbotTask,
ColorField,
CommitFest,
Committer,
MailThread,
MailThreadAttachment,
Patch,
PatchHistory,
PatchOnCommitFest,
Tag,
TargetVersion,
Topic,
)
class CommitterAdmin(admin.ModelAdmin):
list_display = ("user", "active")
class PatchOnCommitFestInline(admin.TabularInline):
model = PatchOnCommitFest
extra = 1
class PatchAdmin(admin.ModelAdmin):
inlines = (PatchOnCommitFestInline,)
list_display = ("name",)
class MailThreadAttachmentAdmin(admin.ModelAdmin):
list_display = (
"date",
"author",
"messageid",
"mailthread",
)
class ColorInput(widgets.Input):
"""
A color picker widget.
TODO: this will be natively available in Django 5.2.
"""
input_type = "color"
class TagAdmin(admin.ModelAdmin):
# Customize the Tag form with a color picker and soft validation.
change_form_template = "change_tag_form.html"
formfield_overrides = {
ColorField: {"widget": ColorInput},
}
admin.site.register(Committer, CommitterAdmin)
admin.site.register(CommitFest)
admin.site.register(Tag, TagAdmin)
admin.site.register(Topic)
admin.site.register(Patch, PatchAdmin)
admin.site.register(PatchHistory)
admin.site.register(TargetVersion)
admin.site.register(CfbotBranch)
admin.site.register(CfbotTask)
admin.site.register(MailThread)
admin.site.register(MailThreadAttachment, MailThreadAttachmentAdmin)