1234567891011121314151617181920212223242526272829 |
- # -*- coding: utf-8 -*-
- from __future__ import unicode_literals
- from tastypie import fields
- from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
- from tastypie.authorization import Authorization
- from core.models.user import User
- from api.resources.group_resource import GroupResource
- '''
- '''
- class UserResource(ModelResource):
- groups = fields.ToManyField(GroupResource, 'groups')
- class Meta:
- queryset = User.objects.all()
- authorization = Authorization()
- always_return_data = True
- # filtering = {
- # 'slug': ALL,
- # 'groups': ALL_WITH_RELATIONS,
- # 'created': ['exact', 'range', 'gt', 'gte', 'lt', 'lte'],
- # }
- '''
- '''
- def obj_create(self, bundle, **kwargs):
- print(bundle)
- print(kwargs)
- return super(UserResource, self).obj_create(bundle)
|