It looks like you're reusing the variable connone. Could that be the issue?

On May 15, 2018 10:38:06 AM CDT, gomahe...@gmail.com wrote:
>I am new to Django started developing the application  but got a
>problem in 
>retrieving the data from already existing data which looks like this
>below.
>   
>   
>   
>  
>{"_id":"5ad72e80bdd7ad184031ab2d","name":"john","country":"usa","place":"xyz"}
>
>{"_id":"5ad72ec6bdd7ad184031ab2e","name":"ron","country":"canada","place":"ABC"}
> 
> 
>         
>The code in the django look like this    
>
>
>    from mongoengine import *
>    from django.shortcuts import render
>    from django.contrib.auth.models import User
>
> 
>    class demo_data(DynamicDocument):
>    meta = {
>        
>        'index_background':True,
>        'collection':'demo_data',
>    }
>    name = StringField(max_length=100)
>    country = StringField(max_length=100)
>    place = StringField(max_length=150)
>    
>    connone = 
>connect(host='mongodb://myusername:mypassw...@example.com/databasename?replicaSet=rs0')
>    
>    
>    def test_extract(request):
>        
>        connone = demo_data()
>        dt_view = connone._data
>        
>        print(dt_view)
>        return render(request,"extract.html",{"dt":dt_view}) 
>
>My  code in extract.html       
>     
>    <html>
>    <body>
>    <p>the data relating to collection {{dt}}</p>
>
>    </body>
>
>    </html>  
>
>And the output which i got after running is this 
>   
>    the data relating to collection {'name': None, 'country': None, 
>'place': None, 'id': None}
>
>Can anyone please help me out from this situation would be  appreciated
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to django-users+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at https://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/9dc0e170-6a1c-46d0-84be-7385158ea59e%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/94AE5694-74A4-4D61-9068-C405E8BF0F6F%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to