Re: bug: mymodel.objects.first().get('id',None) AttributeError: 'NoneType' object has no attribute 'get'

2015-10-27 Thread Erik Cederstrand
> Den 27. okt. 2015 kl. 04.01 skrev gugeshi...@gmail.com: > > hi ,how are you > > i run > > myid=mymodel.objects.first().get('id',None) > > If there is a record, it's ok > > If there is no record, error info: > > AttributeError: 'NoneType' object has no attribute 'get' > > > If there

bug: mymodel.objects.first().get('id',None) AttributeError: 'NoneType' object has no attribute 'get'

2015-10-27 Thread gugeshi250
hi ,how are you i run *myid=mymodel.objects.first().get('id',None) * If there is a record, it's ok If there is no record, error info: *AttributeError: 'NoneType' object has no attribute 'get'* If there is a record,Can you let it return an empty dictionary, thank you -- You received