forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresources.py
More file actions
204 lines (185 loc) · 6.46 KB
/
resources.py
File metadata and controls
204 lines (185 loc) · 6.46 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
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
197
198
199
200
201
202
203
204
# Copyright The IETF Trust 2014-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Autogenerated by the mkresources management command 2014-11-13 23:53
from ietf.api import ModelResource
from tastypie.fields import ToOneField
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from tastypie.cache import SimpleCache
from ietf import api
from ietf.person.models import (Person, Email, Alias, PersonalApiKey, PersonEvent, PersonApiKeyEvent, HistoricalPerson, HistoricalEmail, PersonExtResource) # type: ignore
from ietf.utils.resources import UserResource
class PersonResource(ModelResource):
user = ToOneField(UserResource, 'user', null=True)
class Meta:
cache = SimpleCache()
queryset = Person.objects.all()
serializer = api.Serializer()
#resource_name = 'person'
ordering = ['id', ]
filtering = {
"id": ALL,
"time": ALL,
"name": ALL,
"ascii": ALL,
"ascii_short": ALL,
"affiliation": ALL,
"photo": ALL,
"biography": ALL,
"user": ALL_WITH_RELATIONS,
}
api.person.register(PersonResource())
class EmailResource(ModelResource):
person = ToOneField(PersonResource, 'person', null=True)
class Meta:
cache = SimpleCache()
queryset = Email.objects.all()
serializer = api.Serializer()
#resource_name = 'email'
ordering = ['address', ]
filtering = {
"address": ALL,
"time": ALL,
"active": ALL,
"person": ALL_WITH_RELATIONS,
}
api.person.register(EmailResource())
class AliasResource(ModelResource):
person = ToOneField(PersonResource, 'person')
class Meta:
cache = SimpleCache()
queryset = Alias.objects.all()
serializer = api.Serializer()
#resource_name = 'alias'
ordering = ['id', ]
filtering = {
"id": ALL,
"name": ALL,
"person": ALL_WITH_RELATIONS,
}
api.person.register(AliasResource())
class PersonalApiKeyResource(ModelResource):
person = ToOneField(PersonResource, 'person')
class Meta:
queryset = PersonalApiKey.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
excludes = ['salt', ]
#resource_name = 'personalapikey'
ordering = ['id', ]
filtering = {
"id": ALL,
"endpoint": ALL,
"created": ALL,
"valid": ALL,
"salt": ALL,
"count": ALL,
"latest": ALL,
"person": ALL_WITH_RELATIONS,
}
api.person.register(PersonalApiKeyResource())
class PersonEventResource(ModelResource):
person = ToOneField(PersonResource, 'person')
class Meta:
queryset = PersonEvent.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
#resource_name = 'personevent'
ordering = ['id', ]
filtering = {
"id": ALL,
"time": ALL,
"type": ALL,
"desc": ALL,
"person": ALL_WITH_RELATIONS,
}
api.person.register(PersonEventResource())
class PersonApiKeyEventResource(ModelResource):
person = ToOneField(PersonResource, 'person')
personevent_ptr = ToOneField(PersonEventResource, 'personevent_ptr')
key = ToOneField(PersonalApiKeyResource, 'key')
class Meta:
queryset = PersonApiKeyEvent.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
#resource_name = 'personapikeyevent'
ordering = ['id', ]
filtering = {
"id": ALL,
"time": ALL,
"type": ALL,
"desc": ALL,
"person": ALL_WITH_RELATIONS,
"personevent_ptr": ALL_WITH_RELATIONS,
"key": ALL_WITH_RELATIONS,
}
api.person.register(PersonApiKeyEventResource())
from ietf.utils.resources import UserResource
class HistoricalPersonResource(ModelResource):
user = ToOneField(UserResource, 'user', null=True)
history_user = ToOneField(UserResource, 'history_user', null=True)
class Meta:
queryset = HistoricalPerson.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
#resource_name = 'historicalperson'
ordering = ['id', ]
filtering = {
"id": ALL,
"time": ALL,
"name": ALL,
"ascii": ALL,
"ascii_short": ALL,
"affiliation": ALL,
"biography": ALL,
"photo": ALL,
"photo_thumb": ALL,
"history_id": ALL,
"history_date": ALL,
"history_change_reason": ALL,
"history_type": ALL,
"user": ALL_WITH_RELATIONS,
"history_user": ALL_WITH_RELATIONS,
}
api.person.register(HistoricalPersonResource())
from ietf.utils.resources import UserResource
class HistoricalEmailResource(ModelResource):
person = ToOneField(PersonResource, 'person', null=True)
history_user = ToOneField(UserResource, 'history_user', null=True)
class Meta:
queryset = HistoricalEmail.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
#resource_name = 'historicalemail'
ordering = ['id', ]
filtering = {
"address": ALL,
"time": ALL,
"primary": ALL,
"origin": ALL,
"active": ALL,
"history_id": ALL,
"history_date": ALL,
"history_change_reason": ALL,
"history_type": ALL,
"person": ALL_WITH_RELATIONS,
"history_user": ALL_WITH_RELATIONS,
}
api.person.register(HistoricalEmailResource())
from ietf.name.resources import ExtResourceNameResource
class PersonExtResourceResource(ModelResource):
person = ToOneField(PersonResource, 'person')
name = ToOneField(ExtResourceNameResource, 'name')
class Meta:
queryset = PersonExtResource.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
resource_name = 'personextresource'
ordering = ['id', ]
filtering = {
"id": ALL,
"display_name": ALL,
"value": ALL,
"person": ALL_WITH_RELATIONS,
"name": ALL_WITH_RELATIONS,
}
api.person.register(PersonExtResourceResource())