-
Notifications
You must be signed in to change notification settings - Fork 719
Expand file tree
/
Copy pathresources.py
More file actions
79 lines (72 loc) · 2.67 KB
/
resources.py
File metadata and controls
79 lines (72 loc) · 2.67 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
# Autogenerated by the makeresources management command 2015-08-06 11:00 PDT
from ietf.api import ModelResource
from ietf.api import ToOneField # pyflakes:ignore
from tastypie.fields import ToManyField # pyflakes:ignore
from tastypie.constants import ALL, ALL_WITH_RELATIONS # pyflakes:ignore
from tastypie.cache import SimpleCache
from ietf import api
from ietf.mailtrigger.models import MailTrigger, Recipient
class RecipientResource(ModelResource):
class Meta:
cache = SimpleCache()
queryset = Recipient.objects.all()
#resource_name = 'recipient'
filtering = {
"slug": ALL,
"desc": ALL,
"template": ALL,
}
api.mailtrigger.register(RecipientResource())
class MailTriggerResource(ModelResource):
to = ToManyField(RecipientResource, 'to', null=True)
cc = ToManyField(RecipientResource, 'cc', null=True)
class Meta:
cache = SimpleCache()
queryset = MailTrigger.objects.all()
#resource_name = 'mailtrigger'
filtering = {
"slug": ALL,
"desc": ALL,
"to": ALL_WITH_RELATIONS,
"cc": ALL_WITH_RELATIONS,
}
api.mailtrigger.register(MailTriggerResource())
from ietf.utils.resources import UserResource
class HistoricalMailTriggerResource(ModelResource):
history_user = ToOneField(UserResource, 'history_user', null=True)
class Meta:
queryset = MailTrigger.history.model.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
#resource_name = 'historicalmailtrigger'
ordering = ['history_id', ]
filtering = {
"slug": ALL,
"desc": ALL,
"history_id": ALL,
"history_date": ALL,
"history_change_reason": ALL,
"history_type": ALL,
"history_user": ALL_WITH_RELATIONS,
}
api.mailtrigger.register(HistoricalMailTriggerResource())
from ietf.utils.resources import UserResource
class HistoricalRecipientResource(ModelResource):
history_user = ToOneField(UserResource, 'history_user', null=True)
class Meta:
queryset = Recipient.history.model.objects.all()
serializer = api.Serializer()
cache = SimpleCache()
#resource_name = 'historicalrecipient'
ordering = ['history_id', ]
filtering = {
"slug": ALL,
"desc": ALL,
"template": ALL,
"history_id": ALL,
"history_date": ALL,
"history_change_reason": ALL,
"history_type": ALL,
"history_user": ALL_WITH_RELATIONS,
}
api.mailtrigger.register(HistoricalRecipientResource())