0

I used to interpret one dictionary item on page load . But I want to know how to read a entire dictionary and loop through it and get each value.Thank you in advance.

    def load_product(request):

      name = request.POST.get('clicked')
      usernames = database.child("Items").child('details').get()
      for user in usernames.each():
        userid = user.key()
        dtls = database.child("Items").child('details').child(userid).child('iname').get().val()
         if dtls == name:

             dtls1 = database.child("Items").child('details').child(userid).child('idesc').get().val()

             return render(request, "home.html",data2)
return render(request, "enter_products.html")


    <!DOCTYPE html>
    <html lang="en">
       {% if messg %}
     <script>
       alert('{{ messg }}');

     </script>
   {% endif %}
    <head>



    //new dictionary
    data2 = {"iname": name, "imodel": dtls2, "idesc": dtls1}
Mia Davis
  • 121
  • 8
  • 2
    What templating language is this? You probably want to add that tag. – jmargolisvt Jun 21 '19 at 16:44
  • 1
    Please provide a [mcve] that illustrates your problem. It looks like you are using more than just HTML and JavaScript here because you have some template syntax, too. If the template language doesn't matter, then you should create an example that only uses HTML and JavaScript. – Code-Apprentice Jun 21 '19 at 16:45
  • Ok I just editted my question and provided the python code as well. There is no issue with the python side . I just want to know how to read that data2 dictionary on page load – Mia Davis Jun 21 '19 at 16:49

0 Answers0