Skip to content

Commit

Permalink
modelforms: fixed a bug in boolean defaut values (checkboxes)
Browse files Browse the repository at this point in the history
  • Loading branch information
revolunet committed Feb 4, 2010
1 parent 50d01af commit 33d1cf6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions forms.py
Expand Up @@ -65,7 +65,7 @@ def as_extjsfields(self, excludes = []):
#for lfield in self.instance._meta.fields:
#print 'FIELD INSTANCE :', lfield
#print dir(lfield)
print 'self.fields', self.fields
#print 'self.fields', self.fields
for field in self.fields:
if field in excludes: continue
ofield = self.fields[field]
Expand Down Expand Up @@ -277,7 +277,7 @@ def as_extjsfields(self, excludes = []):
extfield = blank_config.copy()

extfield['xtype'] = 'checkbox'
if getattr(self, 'instance', None) and getattr(self.instance, field, None):
if getattr(self, 'instance', None) and getattr(self.instance, field, -1) != '-1':
extfield['value'] = getattr(self.instance, field)
extfield['checked'] = getattr(self.instance, field)
else:
Expand Down

0 comments on commit 33d1cf6

Please sign in to comment.