Archived
Added expiration date.
This commit is contained in:
1 parent
c244ab5545
commit
7015d7c6af
1 file changed
+12
-1
@@ -1,5 +1,7 @@
|
||||
from tastypie.resources import ModelResource, ALL
|
||||
from tastypie import fields
|
||||
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
|
||||
from tastypie.authorization import Authorization
|
||||
from main.api.member import MemberResource
|
||||
from main.models import *
|
||||
|
||||
|
||||
@@ -8,10 +10,19 @@ class MembershipResource(ModelResource):
|
||||
This class provides following endpoints:
|
||||
(1) /api/v1/membership/
|
||||
"""
|
||||
member = fields.ForeignKey(MemberResource, 'member')
|
||||
|
||||
class Meta:
|
||||
queryset = Membership.objects.all()
|
||||
resource_name = 'membership'
|
||||
list_allowed_methods = [ 'get', 'post' ]
|
||||
detail_allowed_methods = [ 'get', 'post' ]
|
||||
authorization = Authorization() # TODO: for dev (VERY INSECURE)
|
||||
filtering = {
|
||||
'member' : ALL_WITH_RELATIONS,
|
||||
'expires' : [ 'exact','range','gt','gte','lt','lte' ], #TODO: Doesn't work.
|
||||
}
|
||||
|
||||
def dehydrate(self, bundle):
|
||||
bundle.data['expires'] = bundle.obj.expires()
|
||||
return bundle
|
||||
Reference in new issue
Block a user