FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
patchwork/patchwork/admin.py at main · getpatchwork/patchwork · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
getpatchwork
/
patchwork
Public
Notifications
You must be signed in to change notification settings
Fork
90
Star
315
Code
Issues
97
Pull requests
22
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
patchwork
/
patchwork
/
admin.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
196 lines (154 loc) · 4.94 KB
Breadcrumbs
patchwork
/
patchwork
/
admin.py
Copy path
File metadata and controls
196 lines (154 loc) · 4.94 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
from
django
.
contrib
import
admin
from
django
.
contrib
.
auth
.
admin
import
UserAdmin
as
BaseUserAdmin
from
django
.
contrib
.
auth
.
models
import
User
from
django
.
db
.
models
import
Prefetch
from
patchwork
.
models
import
Bundle
from
patchwork
.
models
import
Check
from
patchwork
.
models
import
Cover
from
patchwork
.
models
import
CoverComment
from
patchwork
.
models
import
DelegationRule
from
patchwork
.
models
import
Patch
from
patchwork
.
models
import
PatchComment
from
patchwork
.
models
import
PatchRelation
from
patchwork
.
models
import
Person
from
patchwork
.
models
import
Project
from
patchwork
.
models
import
Series
from
patchwork
.
models
import
SeriesReference
from
patchwork
.
models
import
State
from
patchwork
.
models
import
Tag
from
patchwork
.
models
import
UserProfile
class
UserProfileInline
(
admin
.
StackedInline
):
model
=
UserProfile
can_delete
=
False
verbose_name_plural
=
'user profile'
class
UserAdmin
(
BaseUserAdmin
):
inlines
=
(
UserProfileInline
,)
admin
.
site
.
unregister
(
User
)
admin
.
site
.
register
(
User
,
UserAdmin
)
class
DelegationRuleInline
(
admin
.
TabularInline
):
model
=
DelegationRule
fields
=
(
'path'
,
'user'
,
'priority'
)
@
admin
.
register
(
Project
)
class
ProjectAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'linkname'
,
'listid'
,
'listemail'
)
inlines
=
[
DelegationRuleInline
,
]
@
admin
.
register
(
Person
)
class
PersonAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'__str__'
,
'has_account'
)
search_fields
=
(
'name'
,
'email'
)
@
admin
.
display
(
description
=
'Account'
,
boolean
=
True
,
ordering
=
'user'
,
)
def
has_account
(
self
,
person
):
return
bool
(
person
.
user
)
@
admin
.
register
(
State
)
class
StateAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'action_required'
)
@
admin
.
register
(
Cover
)
class
CoverAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'submitter'
,
'project'
,
'date'
)
list_filter
=
(
'project'
,)
search_fields
=
(
'name'
,
'submitter__name'
,
'submitter__email'
)
date_hierarchy
=
'date'
@
admin
.
register
(
Patch
)
class
PatchAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'submitter'
,
'project'
,
'state'
,
'date'
,
'archived'
,
'is_pull_request'
,
)
list_filter
=
(
'project'
,
'submitter'
,
'state'
,
'archived'
)
list_select_related
=
(
'submitter'
,
'project'
,
'state'
)
search_fields
=
(
'name'
,
'submitter__name'
,
'submitter__email'
)
date_hierarchy
=
'date'
@
admin
.
display
(
description
=
'Pull'
,
boolean
=
True
,
ordering
=
'pull_url'
,
)
def
is_pull_request
(
self
,
patch
):
return
bool
(
patch
.
pull_url
)
@
admin
.
register
(
CoverComment
)
class
CoverCommentAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'cover'
,
'submitter'
,
'date'
)
search_fields
=
(
'cover__name'
,
'submitter__name'
,
'submitter__email'
)
date_hierarchy
=
'date'
@
admin
.
register
(
PatchComment
)
class
PatchCommentAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'patch'
,
'submitter'
,
'date'
)
search_fields
=
(
'patch__name'
,
'submitter__name'
,
'submitter__email'
)
date_hierarchy
=
'date'
class
PatchInline
(
admin
.
StackedInline
):
model
=
Patch
extra
=
0
@
admin
.
register
(
Series
)
class
SeriesAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'submitter'
,
'project'
,
'date'
,
'version'
,
'total'
,
'received_total'
,
'received_all'
,
)
list_filter
=
(
'project'
,
'submitter'
)
list_select_related
=
(
'submitter'
,
'project'
)
readonly_fields
=
(
'received_total'
,
'received_all'
)
search_fields
=
(
'submitter__name'
,
'submitter__email'
)
exclude
=
(
'patches'
,)
filter_horizontal
=
(
'dependencies'
,)
inlines
=
(
PatchInline
,)
@
admin
.
display
(
boolean
=
True
)
def
received_all
(
self
,
series
):
return
series
.
received_all
def
get_queryset
(
self
,
request
):
qs
=
super
(
SeriesAdmin
,
self
).
get_queryset
(
request
)
return
qs
.
prefetch_related
(
Prefetch
(
'patches'
,
Patch
.
objects
.
only
(
'series'
,
),
)
)
@
admin
.
register
(
SeriesReference
)
class
SeriesReferenceAdmin
(
admin
.
ModelAdmin
):
model
=
SeriesReference
@
admin
.
register
(
Check
)
class
CheckAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'patch'
,
'user'
,
'state'
,
'target_url'
,
'description'
,
'context'
,
)
exclude
=
(
'date'
,)
search_fields
=
(
'patch__name'
,
'project__name'
)
date_hierarchy
=
'date'
@
admin
.
register
(
Bundle
)
class
BundleAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'owner'
,
'project'
,
'public'
)
list_filter
=
(
'public'
,
'project'
)
search_fields
=
(
'name'
,
'owner'
)
@
admin
.
register
(
Tag
)
class
TagAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,)
@
admin
.
register
(
PatchRelation
)
class
PatchRelationAdmin
(
admin
.
ModelAdmin
):
model
=
PatchRelation
Back
|
FazBrowse Home
|
New Git URL