Django

Code

Show
Ignore:
Timestamp:
08/28/08 21:40:56 (3 months ago)
Author:
mtredinnick
Message:

Fixed #8101 -- Allow the strings '1' and '0' as filter values for boolean
fields (the latter was causing problems). This allows these values in URLs
(e.g. the admin filtering).

Not an ideal solution to the problem, but will do the job for the time being.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/model_fields/tests.py

    r8616 r8691  
    4646datetime.time(1, 2, 3, 999999) 
    4747 
     48# Boolean and null boolean fields 
     49>>> f = BooleanField() 
     50>>> for val in (True, '1', 1): 
     51...     f.get_db_prep_lookup('exact', val) 
     52[True] 
     53[True] 
     54[True] 
     55>>> for val in (False, '0', 0): 
     56...     f.get_db_prep_lookup('exact', val) 
     57[False] 
     58[False] 
     59[False] 
     60 
     61>>> f = NullBooleanField() 
     62>>> for val in (True, '1', 1): 
     63...     f.get_db_prep_lookup('exact', val) 
     64[True] 
     65[True] 
     66[True] 
     67>>> for val in (False, '0', 0): 
     68...     f.get_db_prep_lookup('exact', val) 
     69[False] 
     70[False] 
     71[False] 
     72>>> f.get_db_prep_lookup('exact', None) 
     73[None] 
    4874 
    4975"""