take a look at the database section of the document. It describes in detail how you will interact with the database API. Usually you use them in your views, where you need to save or retrieve something from the database.
For example, if you want a view to receive users, you might have something like this:
#views.py from pyrebase_settings import db, auth from django.shortcuts import render def get_users(request): users = db.child("users").get() return render(request, 'users.html', {'users': users.val()})
The documentation for obtaining data can be found here.
let's also say that you want the view to save (register) users, you might have something like this:
#views.py from pyrebase_settings import db, auth def signup(request): form = SignupForm(request.POST) if form.is_valid(): email = form.cleaned_data('email') password = form.cleaned_data('password') auth.create_user_with_email_and_password(email, password)
create_user_with_email_and_password method here
PS. I have never used the pyrebase library, so I only write based on what is indicated in its documentation. Also, I only write these django snippets on my head, so I'm sorry if there are any syntax errors or typos :)
Hope this helps :)
source share