def userinfo_json(request, user_id):
    """
    Return the user's information in a json object
    """
    data = {'first_name': '',
            'last_name': '',
            'email': '',
            'slug': '',
            'bio': '',
            'phone': '',
            'is_active': False}

    try:
        member = StaffMember.objects.get(pk=user_id)
        for key in data.keys():
            if hasattr(member, key):
                data[key] = getattr(member, key, '')

    except StaffMember.DoesNotExist:
        pass

    return HttpResponse(json.dumps(data),
                        mimetype='application/json')
def userinfo_json ( request , user_id ) : data = { 'first_name' : '' , 'last_name' : '' , 'email' : '' , 'slug' : '' , 'bio' : '' , 'phone' : '' , 'is_active' : False } try : member = StaffMember . objects . get ( pk = user_id ) for key in data . keys ( ) : if hasattr ( member , key ) : data [ key ] = getattr ( member , key , '' ) except StaffMember . DoesNotExist : pass return HttpResponse ( json . dumps ( data ) , mimetype = 'application/json' )
Return the user's information in a json object