I have a django project. I implimented Firebase into the project. Firebase created and returns objects in JSON format. Now, I want to have a search system through existing users and return an object that has all of the stored username values from the list and then display all of the results.
Here is a sample of a Firebase JSON object format:
OrderedDict([
('info',
{
'bio':'jogn from the office',
'company':'MySplit',
'dob':'1993-03-23',
'first_name':'jim',
'gender':'M',
'last_name':'helpert',
'phone':'+19515394856'
} ),
('location',
{
'city':'Mis Viejo',
'state':'CA',
'street':'27806 cheller',
'zip_code':98892
} ),
('status',
{
'active':'1',
'group':'dev',
'premium':'1'
} ),
('username',
'jimhelpert' )
])
I want to search and return an object with all the usernames that contain jim
I cant find how to make the query that would return all objects with username that contains the phrase...
here is the view.py:
user_id = request.session['uid']
user_profile = database.child('users').child(user_id).child('profile').get()
print(user_profile.key())
print(user_profile.val())
print(user_profile)
print(type(user_profile))
parameters = {
'user_profile':user_profile.val(),
}
return render(request, 'users/user_home.html', parameters)