Repository: django/django
File: django/db/models/fields/__init__.py (Python)

Code before:
        decimal_places=None,
        **kwargs,
    ):
        self.max_digits, self.decimal_places = max_digits, decimal_places
        super().__init__(verbose_name, name, **kwargs)

    def check(self, **kwargs):
        errors = super().check(**kwargs)

        digits_errors = [
            *self._check_decimal_places(),
            *self._check_max_digits(),
        ]
        if not digits_errors:
            errors.extend(self._check_decimal_places_and_max_digits(**kwargs))
        else:
            errors.extend(digits_errors)
        return errors

    def _check_decimal_places(self):
        if self.decimal_places is None:
            if not (
                connection.features.supports_no_precision_decimalfield
                or "supports_no_precision_decimalfield"
                in self.model._meta.required_db_features
            ):
                return [
                    checks.Error(
                        "DecimalFields must define a 'decimal_places' attribute.",
                        obj=self,
                        id="fields.E130",
                    )
                ]
            elif self.max_digits is not None:
                return [
                    checks.Error(
                        "DecimalField’s max_digits and decimal_places must both "
                        "be defined or both omitted.",
                        obj=self,
                        id="fields.E135",
                    ),
                ]
        else:
            try:
                decimal_places = int(self.decimal_places)
                if decimal_places < 0:
                    raise ValueError()
            except ValueError:
                return [
                    checks.Error(
                        "'decimal_places' must be a non-negative integer.",

Review comment (suggestion):
I think it's a bit clearer to distribute the `not` here:

```suggestion
            if (
                not connection.features.supports_no_precision_decimalfield
                and "supports_no_precision_decimalfield"
                not in self.model._meta.required_db_features
            ):
```

Code after:
        decimal_places=None,
        **kwargs,
    ):
        self.max_digits, self.decimal_places = max_digits, decimal_places
        super().__init__(verbose_name, name, **kwargs)

    def check(self, **kwargs):
        errors = super().check(**kwargs)

        digits_errors = [
            *self._check_decimal_places(),
            *self._check_max_digits(),
        ]
        if not digits_errors:
            errors.extend(self._check_decimal_places_and_max_digits(**kwargs))
        else:
            errors.extend(digits_errors)
        return errors

    def _check_decimal_places(self):
        if self.decimal_places is None:
            if (
                not connection.features.supports_no_precision_decimalfield
                and "supports_no_precision_decimalfield"
                not in self.model._meta.required_db_features
            ):
                return [
                    checks.Error(
                        "DecimalFields must define a 'decimal_places' attribute.",
                        obj=self,
                        id="fields.E130",
                    )
                ]
            elif self.max_digits is not None:
                return [
                    checks.Error(
                        "DecimalField’s max_digits and decimal_places must both "
                        "be defined or both omitted.",
                        obj=self,
                        id="fields.E135",
                    ),
                ]
        else:
            try:
                decimal_places = int(self.decimal_places)
                if decimal_places < 0:
                    raise ValueError()
            except ValueError:
                return [
                    checks.Error(
                        "'decimal_places' must be a non-negative integer.",