2012-04-01 5 views

उत्तर

19

कोई अंतर नहीं है, दूसरा मतलब __exact का उपयोग करने का तात्पर्य है।

documentation से

:

For example, the following two statements are equivalent: 
>>> Blog.objects.get(id__exact=14) # Explicit form 
>>> Blog.objects.get(id=14)   
# __exact is implied This is for convenience, because exact 
# lookups are the common case. 
12

आप एसक्यूएल कि Django को क्वेरीसमूह के query संपत्ति परिवर्तित करके निष्पादित करेंगे देख सकते हैं एक स्ट्रिंग:

>>> from django.contrib.auth.models import User 
>>> str(User.objects.filter(username = 'name').query) 
'SELECT ... WHERE `auth_user`.`username` = name ' 
>>> str(User.objects.filter(username__exact = 'name').query) 
'SELECT ... WHERE `auth_user`.`username` = name ' 

तो __exact कोई फर्क नहीं पड़ता।

संबंधित मुद्दे