forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresources.py
More file actions
68 lines (60 loc) · 2.32 KB
/
resources.py
File metadata and controls
68 lines (60 loc) · 2.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
# 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, ToManyField
from tastypie.constants import ALL, ALL_WITH_RELATIONS
from tastypie.cache import SimpleCache
from ietf import api
from ietf.community.models import CommunityList, SearchRule, EmailSubscription
from ietf.doc.resources import DocumentResource
from ietf.group.resources import GroupResource
from ietf.utils.resources import UserResource
class CommunityListResource(ModelResource):
user = ToOneField(UserResource, 'user', null=True)
group = ToOneField(GroupResource, 'group', null=True)
added_docs = ToManyField(DocumentResource, 'added_docs', null=True)
class Meta:
cache = SimpleCache()
queryset = CommunityList.objects.all()
serializer = api.Serializer()
#resource_name = 'communitylist'
ordering = ['id', ]
filtering = {
"id": ALL,
"secret": ALL,
"cached": ALL,
"user": ALL_WITH_RELATIONS,
"group": ALL_WITH_RELATIONS,
"added_docs": ALL_WITH_RELATIONS,
}
api.community.register(CommunityListResource())
class SearchRuleResource(ModelResource):
community_list = ToOneField(CommunityListResource, 'community_list')
class Meta:
cache = SimpleCache()
queryset = SearchRule.objects.all()
serializer = api.Serializer()
#resource_name = 'rule'
ordering = ['id', ]
filtering = {
"id": ALL,
"rule_type": ALL,
"community_list": ALL_WITH_RELATIONS,
}
api.community.register(SearchRuleResource())
class EmailSubscriptionResource(ModelResource):
community_list = ToOneField(CommunityListResource, 'community_list')
class Meta:
cache = SimpleCache()
queryset = EmailSubscription.objects.all()
serializer = api.Serializer()
#resource_name = 'emailsubscription'
ordering = ['id', ]
filtering = {
"id": ALL,
"email": ALL_WITH_RELATIONS,
"notify_on": ALL,
"community_list": ALL_WITH_RELATIONS,
}
api.community.register(EmailSubscriptionResource())