FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
patchwork/patchwork/api/person.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
/
api
/
person.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (32 loc) · 1.19 KB
Breadcrumbs
patchwork
/
patchwork
/
api
/
person.py
Copy path
File metadata and controls
46 lines (32 loc) · 1.19 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
# Patchwork - automated patch tracking system
# Copyright (C) 2016 Linaro Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
from
rest_framework
.
serializers
import
HyperlinkedModelSerializer
from
rest_framework
.
generics
import
ListAPIView
from
rest_framework
.
generics
import
RetrieveAPIView
from
rest_framework
.
permissions
import
IsAuthenticated
from
patchwork
.
api
.
embedded
import
UserSerializer
from
patchwork
.
models
import
Person
class
PersonSerializer
(
HyperlinkedModelSerializer
):
user
=
UserSerializer
(
read_only
=
True
)
class
Meta
:
model
=
Person
fields
=
(
'id'
,
'url'
,
'name'
,
'email'
,
'user'
)
read_only_fields
=
fields
extra_kwargs
=
{
'url'
: {
'view_name'
:
'api-person-detail'
},
}
class
PersonMixin
(
object
):
permission_classes
=
(
IsAuthenticated
,)
serializer_class
=
PersonSerializer
def
get_queryset
(
self
):
return
Person
.
objects
.
all
().
prefetch_related
(
'user'
)
class
PersonList
(
PersonMixin
,
ListAPIView
):
"""List users."""
search_fields
=
(
'name'
,
'email'
)
ordering_fields
=
(
'id'
,
'name'
,
'email'
)
ordering
=
'id'
class
PersonDetail
(
PersonMixin
,
RetrieveAPIView
):
"""Show a user."""
pass
Back
|
FazBrowse Home
|
New Git URL