我有下表条目,
mysql> select id,name from categories;
+----+------------------------+
| id | name |
+----+------------------------+
| 8 | Application Process |
| 9 | Payments |
| 11 | Account Information |
| 12 | Customer Support |
| 13 | Technical Issues |
| 15 | Most Popular Questions |
+----+------------------------+
6 rows in set (0.01 sec)
我给出了以下两个查询,并且都给出了相同的结果:
>>> categories.objects.filter(name__exact="payments")[0].name
u'Payments'
>>> c.objects.filter(name__iexact="payments")[0].name
u'Payments'
这是我的模型:
class categories(models.Model):
name = models.CharField(max_length=32)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
frequency=models.IntegerField(max_length=10, blank = True, null = True)
class Meta:
db_table='categories'
我的问题是,为什么精确和 iexact 提供相同的结果?为什么有两种不同的功能/方法?