1

I have created a web application with flask and firebase. I am using the pyrebase library. The app creates users with firebase and in the registration form I ask the user about which city it lives in, which is then stored in the realtime database. So all users in the same city is stored under the same city in the database. I want to create an admin page with an input field where I can input a city name and then all users assigned to that city will be deleted. Does anybody know how I can create this?

This is the admin view I have created right now (all functions is not done yet, like security etc)

@app.route('/admin', methods=['GET', 'POST'])
def admin():
    if request.method == 'POST':
        city2 = request.form['city2']
        if city2 == db.child(city):
            auth.delete_user_account()
return render_template('admin.html')
RandomMadi
  • 87
  • 2
  • 10
  • 1
    There’s examples here for querying and deleting fire add items with python github.com/thisbejim/Pyrebase. Use the query feature to search the entire database for those that meet your criteria, then loop through those specific items again and delete only them. Keep in mind firebase servers are json, so it’s basically just like indexing a python dictionary – Keegan Murphy Dec 28 '21 at 15:19

0 Answers0