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
57 lines (51 loc) · 1.88 KB
/
Copy pathresources.py
File metadata and controls
57 lines (51 loc) · 1.88 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
# Autogenerated by the mkresources management command 2014-11-13 23:53
from tastypie.resources import ModelResource
from tastypie.fields import ToOneField, ToManyField
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from ietf import api
from ietf.message.models import * # pyflakes:ignore
from ietf.person.resources import PersonResource
from ietf.group.resources import GroupResource
from ietf.doc.resources import DocumentResource
class MessageResource(ModelResource):
by = ToOneField(PersonResource, 'by')
related_groups = ToManyField(GroupResource, 'related_groups', null=True)
related_docs = ToManyField(DocumentResource, 'related_docs', null=True)
class Meta:
queryset = Message.objects.all()
serializer = api.Serializer()
#resource_name = 'message'
filtering = {
"id": ALL,
"time": ALL,
"subject": ALL,
"frm": ALL,
"to": ALL,
"cc": ALL,
"bcc": ALL,
"reply_to": ALL,
"body": ALL,
"content_type": ALL,
"by": ALL_WITH_RELATIONS,
"related_groups": ALL_WITH_RELATIONS,
"related_docs": ALL_WITH_RELATIONS,
}
api.message.register(MessageResource())
from ietf.person.resources import PersonResource
class SendQueueResource(ModelResource):
by = ToOneField(PersonResource, 'by')
message = ToOneField(MessageResource, 'message')
class Meta:
queryset = SendQueue.objects.all()
serializer = api.Serializer()
#resource_name = 'sendqueue'
filtering = {
"id": ALL,
"time": ALL,
"send_at": ALL,
"sent_at": ALL,
"note": ALL,
"by": ALL_WITH_RELATIONS,
"message": ALL_WITH_RELATIONS,
}
api.message.register(SendQueueResource())