#17747: BooleanField on ModelForms in ModelAdmin is always True -------------------------------------+------------------------------------- Reporter: Cochise Ruhulessin | Owner: nobody Type: Bug | Status: closed Component: Uncategorized | Version: Severity: Release blocker | 1.4-beta-1 Keywords: booleanfield, | Resolution: modelform, modeladmin | worksforme Has patch: 0 | Triage Stage: Needs tests: 0 | Unreviewed Easy pickings: 0 | Needs documentation: 0 | Patch needs improvement: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by ramiro):
* status: reopened => closed * resolution: => worksforme Comment: Can't reproduce that wither with r17575 and this when trying to edit a already existing instance of !ModelThree that has its boolean field set to False: {{{ # admin.py class ModelThreeForm(forms.ModelForm): def __init__(self, *args, **kwargs): instance = kwargs.get('instance', None) if instance: boolean_field_value1 = instance.boolean_field model2dict = forms.models.model_to_dict(instance) super(ModelThreeForm, self).__init__(*args, **kwargs) boolean_field_value2 = self.fields['boolean_field'].initial raise Exception class Meta: model = ModelThree class ModelThreeAdmin(admin.ModelAdmin): form = ModelThreeForm admin.site.register(ModelThree, ModelThreeAdmin) }}} {{{ model2dict {'boolean_field': False, 'id': 1} self <django.forms.models.ModelThreeForm object at 0x159e890> args () instance <ModelThree: ModelThree object> kwargs {'instance': <ModelThree: ModelThree object>} boolean_field_value1 False boolean_field_value2 False }}} Please don't reopen this ticket as this doesn't appear to be an error in Django code. Try to seek help in the django-users mailing list or the #django IRC channel @ Freenode. Also, for future reports, please provide a simple test case (reducing your model(s) to its minimal expression showing the buggy behavior). -- Ticket URL: <https://code.djangoproject.com/ticket/17747#comment:3> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.