dimanche 2 septembre 2018

how can i make ~[0] plus to ~[1] in django?

  1. codes:

    >>> from test2.models import Member_info
    
    >>> member = Member_info.objects.all()
    
    >>> member
    <QuerySet [<Member_info: John2>, <Member_info: John1>, <Member_info: John3>]>
    
    >>> member = Member_info.objects.all()[0]
    
    >>> member
    <Member_info: gun2>
    
    >>> member += Member_info.obejcts.all()[1]
    
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
    AttributeError: type object 'Member_info' has no attribute 'obejcts'
    
    >>> member += Member_info.objects.all()[1]
    
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
    TypeError: unsupported operand type(s) for +=: 'Member_info' and 'Member_info'
    
    >>> member.append(Member_info.objects.all()[1])
    
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
    AttributeError: 'Member_info' object has no attribute 'append'
    
    

2.How can i append,,,,?




Aucun commentaire:

Enregistrer un commentaire