# -*- 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 django.contrib.auth.models 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)