Demo entry 6062160

1111

   

Submitted by 1111 on Sep 22, 2016 at 23:05
Language: ANTLR With Python Target. Code size: 645 Bytes.

#django models.objects 数据管理器用法

#简单equal查询
#Select * from Reporter where full_name='Jack Johns'
Reporter.objects.filter(full_name='Jack Johns')
<QuerySet [object]>

#and条件查询
#Select * from Reporter where full_name='Jack Johns' and full_name like '%Z%'
Reporter.objects.filter(full_name='Jack Johns',full_name__contains='Z')
<Queryset [object]>


#__contains/sql like语句
#select * from Reporter where full_name like '%jack%'
Reporter.objects.filter(full_name__contains='jack')

#__in/sql in语句
#select * from where full_name in ('Jack Johns','John Smith')
Reporter.objects.filter(full_name__in['Jack Johns','John Smith'])

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).