﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29979	Refactor AutoField logic into a mixin, implement checks and validators.	Nick Pope	Nick Pope	"Currently `AutoField` inherits from `Field` and `BigAutoField` from `AutoField`. In effect they largely redefine `IntegerField` and `BigIntegerField` respectively, but add in the auto field ""behaviour"". As a result they do not perform some of the system checks, e.g. `max_length` warning, nor the validation checks, e.g. range checks, that the integer fields do.

The proposal is to move all the auto field ""behaviour"" into a new `AutoFieldMixin` and fix `AutoField` and `BigAutoField` to inherit from this new mixin and `IntegerField` and `BigIntegerField` respectively.

Many attributes and methods would be nicely inherited from the correct parent field type without requiring redefinition:

- `description`
- `empty_strings_allowed`
- `default_error_messages`
- `get_prep_value()`
- `to_python()`

`AutoField` and `BigAutoField` could also inherit the following checks from `IntegerField`:

- `IntegerField._check_max_length_warning()`

`AutoField` and `BigAutoField` could also perform minimum and maximum value validation checks inherited from `IntegerField`.

This should be backwards compatible and potentially will make it easier to define new types of auto fields based on other fields in the future."	Cleanup/optimization	closed	Database layer (models, ORM)	dev	Normal	fixed	autofield, validators		Accepted	1	0	0	0	0	0
