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
134 lines (123 loc) · 5.32 KB
/
Copy pathresources.py
File metadata and controls
134 lines (123 loc) · 5.32 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
# Copyright The IETF Trust 2015-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Autogenerated by the makeresources management command 2015-10-11 13:15 PDT
from ietf.api import ModelResource
from ietf.api import ToOneField
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.liaisons.models import (LiaisonStatement, LiaisonStatementGroupContacts,
LiaisonStatementEvent, LiaisonStatementAttachment, RelatedLiaisonStatement)
from ietf.person.resources import EmailResource
from ietf.group.resources import GroupResource
from ietf.name.resources import LiaisonStatementPurposeNameResource, LiaisonStatementTagNameResource, LiaisonStatementStateResource
from ietf.doc.resources import DocumentResource
class LiaisonStatementResource(ModelResource):
from_contact = ToOneField(EmailResource, 'from_contact', null=True)
purpose = ToOneField(LiaisonStatementPurposeNameResource, 'purpose')
state = ToOneField(LiaisonStatementStateResource, 'state')
from_groups = ToManyField(GroupResource, 'from_groups', null=True)
to_groups = ToManyField(GroupResource, 'to_groups', null=True)
tags = ToManyField(LiaisonStatementTagNameResource, 'tags', null=True)
attachments = ToManyField(DocumentResource, 'attachments', null=True)
class Meta:
cache = SimpleCache()
queryset = LiaisonStatement.objects.all()
serializer = api.Serializer()
#resource_name = 'liaisonstatement'
ordering = ['id', ]
filtering = {
"id": ALL,
"title": ALL,
"to_contacts": ALL,
"response_contacts": ALL,
"technical_contacts": ALL,
"action_holder_contacts": ALL,
"cc_contacts": ALL,
"deadline": ALL,
"other_identifiers": ALL,
"body": ALL,
"from_name": ALL,
"to_name": ALL,
"from_contact": ALL_WITH_RELATIONS,
"purpose": ALL_WITH_RELATIONS,
"state": ALL_WITH_RELATIONS,
"from_groups": ALL_WITH_RELATIONS,
"to_groups": ALL_WITH_RELATIONS,
"tags": ALL_WITH_RELATIONS,
"attachments": ALL_WITH_RELATIONS,
}
api.liaisons.register(LiaisonStatementResource())
from ietf.group.resources import GroupResource
class LiaisonStatementGroupContactsResource(ModelResource):
group = ToOneField(GroupResource, 'group')
class Meta:
cache = SimpleCache()
queryset = LiaisonStatementGroupContacts.objects.all()
serializer = api.Serializer()
#resource_name = 'liaisonstatementgroupcontacts'
ordering = ['id', ]
filtering = {
"id": ALL,
"contacts": ALL,
"cc_contacts": ALL,
"group": ALL_WITH_RELATIONS,
}
api.liaisons.register(LiaisonStatementGroupContactsResource())
from ietf.person.resources import PersonResource
from ietf.name.resources import LiaisonStatementEventTypeNameResource
class LiaisonStatementEventResource(ModelResource):
type = ToOneField(LiaisonStatementEventTypeNameResource, 'type')
by = ToOneField(PersonResource, 'by')
statement = ToOneField(LiaisonStatementResource, 'statement')
class Meta:
cache = SimpleCache()
queryset = LiaisonStatementEvent.objects.all()
serializer = api.Serializer()
#resource_name = 'liaisonstatementevent'
ordering = ['id', ]
filtering = {
"id": ALL,
"time": ALL,
"desc": ALL,
"type": ALL_WITH_RELATIONS,
"by": ALL_WITH_RELATIONS,
"statement": ALL_WITH_RELATIONS,
}
api.liaisons.register(LiaisonStatementEventResource())
from ietf.doc.resources import DocumentResource
class LiaisonStatementAttachmentResource(ModelResource):
statement = ToOneField(LiaisonStatementResource, 'statement')
document = ToOneField(DocumentResource, 'document')
class Meta:
cache = SimpleCache()
queryset = LiaisonStatementAttachment.objects.all()
serializer = api.Serializer()
#resource_name = 'liaisonstatementattachment'
ordering = ['id', ]
filtering = {
"id": ALL,
"removed": ALL,
"statement": ALL_WITH_RELATIONS,
"document": ALL_WITH_RELATIONS,
}
api.liaisons.register(LiaisonStatementAttachmentResource())
from ietf.name.resources import DocRelationshipNameResource
class RelatedLiaisonStatementResource(ModelResource):
source = ToOneField(LiaisonStatementResource, 'source')
target = ToOneField(LiaisonStatementResource, 'target')
relationship = ToOneField(DocRelationshipNameResource, 'relationship')
class Meta:
cache = SimpleCache()
queryset = RelatedLiaisonStatement.objects.all()
serializer = api.Serializer()
#resource_name = 'relatedliaisonstatement'
ordering = ['id', ]
filtering = {
"id": ALL,
"source": ALL_WITH_RELATIONS,
"target": ALL_WITH_RELATIONS,
"relationship": ALL_WITH_RELATIONS,
}
api.liaisons.register(RelatedLiaisonStatementResource())