AbstractUser._meta.get_field('email')._unique = True AbstractUser._meta.get_field('email').blank = False AbstractUser._meta.get_field('email').null = False
This worked and I checked the database. However, when I create a user on the default administration page, he will create it without problems and an empty email field. When you try to save it, he will only ask about it. But it is still a goog solution. I didnβt even need a court. I recommend that you make sure you need an email when creating a new user from the submissions. * Using django 1.10 and SQlite3
It will also give you an idea of ββthe fields that you can override:
(If someone finds a way to create the field needed when creating it, leave a comment :))
dir(User._meta.get_field('email')) Out[3]: ['__class__', '__copy__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__unicode__', '__weakref__', '_blank', '_check_backend_specific_checks', '_check_choices', '_check_db_index', '_check_deprecation_details', '_check_field_name', '_check_max_length_attribute', '_check_null_allowed_for_primary_keys', '_description', '_error_messages', '_get_flatchoices', '_get_lookup', '_get_val_from_obj', '_unique', '_unregister_lookup', '_validators', '_verbose_name', 'attname', 'auto_created', 'auto_creation_counter', 'blank', 'cached_col', 'check', 'choices', 'class_lookups', 'clean', 'clone', 'column', 'concrete', 'contribute_to_class', 'creation_counter', 'db_check', 'db_column', 'db_index', 'db_parameters', 'db_tablespace', 'db_type', 'db_type_suffix', 'deconstruct', 'default', 'default_error_messages', 'default_validators', 'description', 'editable', 'empty_strings_allowed', 'empty_values', 'error_messages', 'flatchoices', 'formfield', 'get_attname', 'get_attname_column', 'get_cache_name', 'get_choices', 'get_col', 'get_db_converters', 'get_db_prep_save', 'get_db_prep_value', 'get_default', 'get_filter_kwargs_for_object', 'get_internal_type', 'get_lookup', 'get_pk_value_on_save', 'get_prep_value', 'get_transform', 'has_default', 'help_text', 'hidden', 'is_relation', 'many_to_many', 'many_to_one', 'max_length', 'model', 'name', 'null', 'one_to_many', 'one_to_one', 'pre_save', 'primary_key', 'register_lookup', 'rel', 'rel_db_type', 'related_model', 'remote_field', 'run_validators', 'save_form_data', 'select_format', 'serialize', 'set_attributes_from_name', 'system_check_deprecated_details', 'system_check_removed_details', 'to_python', 'unique', 'unique_for_date', 'unique_for_month', 'unique_for_year', 'validate', 'validators', 'value_from_object', 'value_to_string', 'verbose_name']