(self, bundle)
return bundle
Protects user's personal information from non staff
Protects user's personal information from non staff
Protects user s personal information from non staff
def dehydrate(self, bundle):
        """
        Protects user's personal information from non staff
        """
        is_owner = bundle.request.user == bundle.obj
        is_admin = bundle.request.user.is_staff or bundle.request.user.is_superuser
        if not (is_owner or is_admin):
            bundle.data = dict(id=bundle.obj.id, username=bundle.obj)
        return bundle
def dehydrate ( self , bundle ) : is_owner = bundle . request . user == bundle . obj is_admin = bundle . request . user . is_staff or bundle . request . user . is_superuser if not ( is_owner or is_admin ) : bundle . data = dict ( id = bundle . obj . id , username = bundle . obj ) return bundle