Ticket #1353: trunk-is_required_check_null.diff

File trunk-is_required_check_null.diff, 728 bytes (added by Tom Tobin <korpios@…>, 19 years ago)

Check a Field instance's null attribute when setting is_required (against r2306 of trunk)

  • core/meta/fields.py

     
    269269        # are a special case, and fields in a related context should set this
    270270        # as False, because they'll be caught by a separate validator --
    271271        # RequiredIfOtherFieldGiven.
    272         params['is_required'] = not self.blank and not self.primary_key and not rel
     272        params['is_required'] = not (self.null or self.blank) and not self.primary_key and not rel
    273273
    274274        # If this field is in a related context, check whether any other fields
    275275        # in the related object have core=True. If so, add a validator --
Back to Top